<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE CPP #-}</span><span class="hs-cpp">
#if __GLASGOW_HASKELL__ &gt;= 702
</span><span class="hs-pragma">{-# LANGUAGE Safe #-}</span><span class="hs-cpp">
#endif
</span><span class="hs-cpp">#if __GLASGOW_HASKELL__ &gt;= 710
</span><span class="hs-pragma">{-# LANGUAGE AutoDeriveTypeable #-}</span><span class="hs-cpp">
#endif
</span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-10"></span><span class="hs-comment">-- Module      :  Control.Monad.Trans.RWS.CPS</span><span>
</span><span id="line-11"></span><span class="hs-comment">-- Copyright   :  (c) Daniel Mendler 2016,</span><span>
</span><span id="line-12"></span><span class="hs-comment">--                (c) Andy Gill 2001,</span><span>
</span><span id="line-13"></span><span class="hs-comment">--                (c) Oregon Graduate Institute of Science and Technology, 2001</span><span>
</span><span id="line-14"></span><span class="hs-comment">-- License     :  BSD-style (see the file LICENSE)</span><span>
</span><span id="line-15"></span><span class="hs-comment">--</span><span>
</span><span id="line-16"></span><span class="hs-comment">-- Maintainer  :  R.Paterson@city.ac.uk</span><span>
</span><span id="line-17"></span><span class="hs-comment">-- Stability   :  experimental</span><span>
</span><span id="line-18"></span><span class="hs-comment">-- Portability :  portable</span><span>
</span><span id="line-19"></span><span class="hs-comment">--</span><span>
</span><span id="line-20"></span><span class="hs-comment">-- A monad transformer that combines 'ReaderT', 'WriterT' and 'StateT'.</span><span>
</span><span id="line-21"></span><span class="hs-comment">-- This version uses continuation-passing-style for the writer part</span><span>
</span><span id="line-22"></span><span class="hs-comment">-- to achieve constant space usage.</span><span>
</span><span id="line-23"></span><span class="hs-comment">-- For a lazy version with the same interface,</span><span>
</span><span id="line-24"></span><span class="hs-comment">-- see &quot;Control.Monad.Trans.RWS.Lazy&quot;.</span><span>
</span><span id="line-25"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-26"></span><span>  </span><span>
</span><span id="line-27"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Control.Monad.Trans.RWS.CPS</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-28"></span><span>    </span><span class="annot"><span class="hs-comment">-- * The RWS monad</span></span><span>
</span><span id="line-29"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWS"><span class="hs-identifier">RWS</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-30"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#rws"><span class="hs-identifier">rws</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-31"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#runRWS"><span class="hs-identifier">runRWS</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-32"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#evalRWS"><span class="hs-identifier">evalRWS</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-33"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#execRWS"><span class="hs-identifier">execRWS</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-34"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#mapRWS"><span class="hs-identifier">mapRWS</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-35"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#withRWS"><span class="hs-identifier">withRWS</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-36"></span><span>    </span><span class="annot"><span class="hs-comment">-- * The RWST monad transformer</span></span><span>
</span><span id="line-37"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier">RWST</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-38"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#rwsT"><span class="hs-identifier">rwsT</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-39"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#runRWST"><span class="hs-identifier">runRWST</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-40"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#evalRWST"><span class="hs-identifier">evalRWST</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-41"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#execRWST"><span class="hs-identifier">execRWST</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-42"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#mapRWST"><span class="hs-identifier">mapRWST</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-43"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#withRWST"><span class="hs-identifier">withRWST</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-44"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Reader operations</span></span><span>
</span><span id="line-45"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#reader"><span class="hs-identifier">reader</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-46"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#ask"><span class="hs-identifier">ask</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-47"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#local"><span class="hs-identifier">local</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-48"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#asks"><span class="hs-identifier">asks</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-49"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Writer operations</span></span><span>
</span><span id="line-50"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#writer"><span class="hs-identifier">writer</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-51"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#tell"><span class="hs-identifier">tell</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-52"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#listen"><span class="hs-identifier">listen</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-53"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#listens"><span class="hs-identifier">listens</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-54"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#pass"><span class="hs-identifier">pass</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-55"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#censor"><span class="hs-identifier">censor</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-56"></span><span>    </span><span class="annot"><span class="hs-comment">-- * State operations</span></span><span>
</span><span id="line-57"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#state"><span class="hs-identifier">state</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-58"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#get"><span class="hs-identifier">get</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-59"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#put"><span class="hs-identifier">put</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-60"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#modify"><span class="hs-identifier">modify</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-61"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#gets"><span class="hs-identifier">gets</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-62"></span><span>    </span><span class="annot"><span class="hs-comment">-- * Lifting other operations</span></span><span>
</span><span id="line-63"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#liftCallCC"><span class="hs-identifier">liftCallCC</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-64"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#liftCallCC%27"><span class="hs-identifier">liftCallCC'</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-65"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#liftCatch"><span class="hs-identifier">liftCatch</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-66"></span><span>  </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-67"></span><span>
</span><span id="line-68"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Applicative.html#"><span class="hs-identifier">Control.Applicative</span></a></span><span>
</span><span id="line-69"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span>
</span><span id="line-70"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.Fix.html#"><span class="hs-identifier">Control.Monad.Fix</span></a></span><span>
</span><span id="line-71"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.IO.Class.html#"><span class="hs-identifier">Control.Monad.IO.Class</span></a></span><span>
</span><span id="line-72"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Class.html"><span class="hs-identifier">Control.Monad.Trans.Class</span></a></span><span>
</span><span id="line-73"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Control.Monad.Signatures.html"><span class="hs-identifier">Control.Monad.Signatures</span></a></span><span>
</span><span id="line-74"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Functor.Identity.html#"><span class="hs-identifier">Data.Functor.Identity</span></a></span><span class="hs-cpp">

#if !(MIN_VERSION_base(4,8,0))
</span><span class="hs-keyword">import</span><span> </span><span class="hs-identifier">Data.Monoid</span><span class="hs-cpp">
#endif
</span><span class="hs-cpp">
#if MIN_VERSION_base(4,9,0)
</span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.Fail.html#"><span class="hs-identifier">Control.Monad.Fail</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Fail</span></span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-84"></span><span class="hs-comment">-- | A monad containing an environment of type @r@, output of type @w@</span><span>
</span><span id="line-85"></span><span class="hs-comment">-- and an updatable state of type @s@.</span><span>
</span><span id="line-86"></span><span class="hs-keyword">type</span><span> </span><span id="RWS"><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWS"><span class="hs-identifier hs-var">RWS</span></a></span></span><span> </span><span id="local-6989586621679077948"><span class="annot"><a href="#local-6989586621679077948"><span class="hs-identifier hs-type">r</span></a></span></span><span> </span><span id="local-6989586621679077947"><span class="annot"><a href="#local-6989586621679077947"><span class="hs-identifier hs-type">w</span></a></span></span><span> </span><span id="local-6989586621679077946"><span class="annot"><a href="#local-6989586621679077946"><span class="hs-identifier hs-type">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679077948"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679077947"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679077946"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="../../base/src/Data.Functor.Identity.html#Identity"><span class="hs-identifier hs-type">Identity</span></a></span><span>
</span><span id="line-87"></span><span>
</span><span id="line-88"></span><span class="hs-comment">-- | Construct an RWS computation from a function.</span><span>
</span><span id="line-89"></span><span class="hs-comment">-- (The inverse of 'runRWS'.)</span><span>
</span><span id="line-90"></span><span id="local-6989586621679078433"><span id="local-6989586621679078434"><span id="local-6989586621679078435"><span id="local-6989586621679078436"><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#rws"><span class="hs-identifier hs-type">rws</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078436"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679078435"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679078434"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679078433"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679078434"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679078436"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWS"><span class="hs-identifier hs-type">RWS</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078435"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078436"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078434"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078433"><span class="hs-identifier hs-type">a</span></a></span></span></span></span></span><span>
</span><span id="line-91"></span><span id="rws"><span class="annot"><span class="annottext">rws :: forall w r s a. Monoid w =&gt; (r -&gt; s -&gt; (a, s, w)) -&gt; RWS r w s a
</span><a href="Control.Monad.Trans.RWS.CPS.html#rws"><span class="hs-identifier hs-var hs-var">rws</span></a></span></span><span> </span><span id="local-6989586621679077942"><span class="annot"><span class="annottext">r -&gt; s -&gt; (a, s, w)
</span><a href="#local-6989586621679077942"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(r -&gt; s -&gt; w -&gt; Identity (a, s, w)) -&gt; RWST r w s Identity a
forall r w s (m :: * -&gt; *) a.
(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-var">RWST</span></a></span><span> </span><span class="annot"><span class="annottext">((r -&gt; s -&gt; w -&gt; Identity (a, s, w)) -&gt; RWST r w s Identity a)
-&gt; (r -&gt; s -&gt; w -&gt; Identity (a, s, w)) -&gt; RWST r w s Identity a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679077940"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077940"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span id="local-6989586621679077939"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077939"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679077938"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077938"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-92"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679077937"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679077937"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679077936"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077936"><span class="hs-identifier hs-var">s'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679077935"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077935"><span class="hs-identifier hs-var">w'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">r -&gt; s -&gt; (a, s, w)
</span><a href="#local-6989586621679077942"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077940"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077939"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">;</span><span> </span><span id="local-6989586621679077933"><span class="annot"><span class="annottext">wt :: w
</span><a href="#local-6989586621679077933"><span class="hs-identifier hs-var hs-var">wt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077938"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">w -&gt; w -&gt; w
forall a. Monoid a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#mappend"><span class="hs-operator hs-var">`mappend`</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077935"><span class="hs-identifier hs-var">w'</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077933"><span class="hs-identifier hs-var">wt</span></a></span><span> </span><span class="annot"><span class="annottext">w -&gt; Identity (a, s, w) -&gt; Identity (a, s, w)
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">(a, s, w) -&gt; Identity (a, s, w)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679077937"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077936"><span class="hs-identifier hs-var">s'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077933"><span class="hs-identifier hs-var">wt</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-93"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#rws"><span class="hs-pragma hs-type">rws</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-94"></span><span>
</span><span id="line-95"></span><span class="hs-comment">-- | Unwrap an RWS computation as a function.</span><span>
</span><span id="line-96"></span><span class="hs-comment">-- (The inverse of 'rws'.)</span><span>
</span><span id="line-97"></span><span id="local-6989586621679078409"><span id="local-6989586621679078410"><span id="local-6989586621679078411"><span id="local-6989586621679078412"><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#runRWS"><span class="hs-identifier hs-type">runRWS</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078412"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWS"><span class="hs-identifier hs-type">RWS</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078411"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078412"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078410"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078409"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679078411"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679078410"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679078409"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679078410"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679078412"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span></span></span></span></span><span>
</span><span id="line-98"></span><span id="runRWS"><span class="annot"><span class="annottext">runRWS :: forall w r s a. Monoid w =&gt; RWS r w s a -&gt; r -&gt; s -&gt; (a, s, w)
</span><a href="Control.Monad.Trans.RWS.CPS.html#runRWS"><span class="hs-identifier hs-var hs-var">runRWS</span></a></span></span><span> </span><span id="local-6989586621679077930"><span class="annot"><span class="annottext">RWS r w s a
</span><a href="#local-6989586621679077930"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679077929"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077929"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span id="local-6989586621679077928"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077928"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Identity (a, s, w) -&gt; (a, s, w)
forall a. Identity a -&gt; a
</span><a href="../../base/src/Data.Functor.Identity.html#runIdentity"><span class="hs-identifier hs-var hs-var">runIdentity</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RWS r w s a -&gt; r -&gt; s -&gt; Identity (a, s, w)
forall w r s (m :: * -&gt; *) a.
Monoid w =&gt;
RWST r w s m a -&gt; r -&gt; s -&gt; m (a, s, w)
</span><a href="Control.Monad.Trans.RWS.CPS.html#runRWST"><span class="hs-identifier hs-var">runRWST</span></a></span><span> </span><span class="annot"><span class="annottext">RWS r w s a
</span><a href="#local-6989586621679077930"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077929"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077928"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-99"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#runRWS"><span class="hs-pragma hs-type">runRWS</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-100"></span><span>
</span><span id="line-101"></span><span class="hs-comment">-- | Evaluate a computation with the given initial state and environment,</span><span>
</span><span id="line-102"></span><span class="hs-comment">-- returning the final value and output, discarding the final state.</span><span>
</span><span id="line-103"></span><span id="local-6989586621679078395"><span id="local-6989586621679078396"><span id="local-6989586621679078397"><span id="local-6989586621679078398"><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#evalRWS"><span class="hs-identifier hs-type">evalRWS</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078398"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-104"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWS"><span class="hs-identifier hs-type">RWS</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078397"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078398"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078396"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078395"><span class="hs-identifier hs-type">a</span></a></span><span>  </span><span class="hs-comment">-- ^RWS computation to execute</span><span>
</span><span id="line-105"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679078397"><span class="hs-identifier hs-type">r</span></a></span><span>            </span><span class="hs-comment">-- ^initial environment</span><span>
</span><span id="line-106"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679078396"><span class="hs-identifier hs-type">s</span></a></span><span>            </span><span class="hs-comment">-- ^initial value</span><span>
</span><span id="line-107"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679078395"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679078398"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span></span></span></span></span><span>       </span><span class="hs-comment">-- ^final value and output</span><span>
</span><span id="line-108"></span><span id="evalRWS"><span class="annot"><span class="annottext">evalRWS :: forall w r s a. Monoid w =&gt; RWS r w s a -&gt; r -&gt; s -&gt; (a, w)
</span><a href="Control.Monad.Trans.RWS.CPS.html#evalRWS"><span class="hs-identifier hs-var hs-var">evalRWS</span></a></span></span><span> </span><span id="local-6989586621679077925"><span class="annot"><span class="annottext">RWS r w s a
</span><a href="#local-6989586621679077925"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679077924"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077924"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span id="local-6989586621679077923"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077923"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span>
</span><span id="line-109"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621679077921"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679077921"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">s
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679077920"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077920"><span class="hs-identifier hs-var">w</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RWS r w s a -&gt; r -&gt; s -&gt; (a, s, w)
forall w r s a. Monoid w =&gt; RWS r w s a -&gt; r -&gt; s -&gt; (a, s, w)
</span><a href="Control.Monad.Trans.RWS.CPS.html#runRWS"><span class="hs-identifier hs-var">runRWS</span></a></span><span> </span><span class="annot"><span class="annottext">RWS r w s a
</span><a href="#local-6989586621679077925"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077924"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077923"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-110"></span><span>    </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679077921"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077920"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-111"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#evalRWS"><span class="hs-pragma hs-type">evalRWS</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-112"></span><span>
</span><span id="line-113"></span><span class="hs-comment">-- | Evaluate a computation with the given initial state and environment,</span><span>
</span><span id="line-114"></span><span class="hs-comment">-- returning the final state and output, discarding the final value.</span><span>
</span><span id="line-115"></span><span id="local-6989586621679078387"><span id="local-6989586621679078388"><span id="local-6989586621679078389"><span id="local-6989586621679078390"><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#execRWS"><span class="hs-identifier hs-type">execRWS</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078390"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-116"></span><span>        </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWS"><span class="hs-identifier hs-type">RWS</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078389"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078390"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078388"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078387"><span class="hs-identifier hs-type">a</span></a></span><span>  </span><span class="hs-comment">-- ^RWS computation to execute</span><span>
</span><span id="line-117"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679078389"><span class="hs-identifier hs-type">r</span></a></span><span>            </span><span class="hs-comment">-- ^initial environment</span><span>
</span><span id="line-118"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679078388"><span class="hs-identifier hs-type">s</span></a></span><span>            </span><span class="hs-comment">-- ^initial value</span><span>
</span><span id="line-119"></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679078388"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679078390"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span></span></span></span></span><span>       </span><span class="hs-comment">-- ^final state and output</span><span>
</span><span id="line-120"></span><span id="execRWS"><span class="annot"><span class="annottext">execRWS :: forall w r s a. Monoid w =&gt; RWS r w s a -&gt; r -&gt; s -&gt; (s, w)
</span><a href="Control.Monad.Trans.RWS.CPS.html#execRWS"><span class="hs-identifier hs-var hs-var">execRWS</span></a></span></span><span> </span><span id="local-6989586621679077918"><span class="annot"><span class="annottext">RWS r w s a
</span><a href="#local-6989586621679077918"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679077917"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077917"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span id="local-6989586621679077916"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077916"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span>
</span><span id="line-121"></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679077914"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077914"><span class="hs-identifier hs-var">s'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679077913"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077913"><span class="hs-identifier hs-var">w</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RWS r w s a -&gt; r -&gt; s -&gt; (a, s, w)
forall w r s a. Monoid w =&gt; RWS r w s a -&gt; r -&gt; s -&gt; (a, s, w)
</span><a href="Control.Monad.Trans.RWS.CPS.html#runRWS"><span class="hs-identifier hs-var">runRWS</span></a></span><span> </span><span class="annot"><span class="annottext">RWS r w s a
</span><a href="#local-6989586621679077918"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077917"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077916"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-122"></span><span>    </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077914"><span class="hs-identifier hs-var">s'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077913"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-123"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#execRWS"><span class="hs-pragma hs-type">execRWS</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-124"></span><span>
</span><span id="line-125"></span><span class="hs-comment">-- | Map the return value, final state and output of a computation using</span><span>
</span><span id="line-126"></span><span class="hs-comment">-- the given function.</span><span>
</span><span id="line-127"></span><span class="hs-comment">--</span><span>
</span><span id="line-128"></span><span class="hs-comment">-- * @'runRWS' ('mapRWS' f m) r s = f ('runRWS' m r s)@</span><span>
</span><span id="line-129"></span><span id="local-6989586621679078377"><span id="local-6989586621679078378"><span id="local-6989586621679078379"><span id="local-6989586621679078380"><span id="local-6989586621679078381"><span id="local-6989586621679078382"><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#mapRWS"><span class="hs-identifier hs-type">mapRWS</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078382"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078381"><span class="hs-identifier hs-type">w'</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679078380"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679078379"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679078382"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679078378"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679078379"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679078381"><span class="hs-identifier hs-type">w'</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWS"><span class="hs-identifier hs-type">RWS</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078377"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078382"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078379"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078380"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWS"><span class="hs-identifier hs-type">RWS</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078377"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078381"><span class="hs-identifier hs-type">w'</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078379"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078378"><span class="hs-identifier hs-type">b</span></a></span></span></span></span></span></span></span><span>
</span><span id="line-130"></span><span id="mapRWS"><span class="annot"><span class="annottext">mapRWS :: forall w w' a s b r.
(Monoid w, Monoid w') =&gt;
((a, s, w) -&gt; (b, s, w')) -&gt; RWS r w s a -&gt; RWS r w' s b
</span><a href="Control.Monad.Trans.RWS.CPS.html#mapRWS"><span class="hs-identifier hs-var hs-var">mapRWS</span></a></span></span><span> </span><span id="local-6989586621679077907"><span class="annot"><span class="annottext">(a, s, w) -&gt; (b, s, w')
</span><a href="#local-6989586621679077907"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Identity (a, s, w) -&gt; Identity (b, s, w'))
-&gt; RWST r w s Identity a -&gt; RWST r w' s Identity b
forall (n :: * -&gt; *) w w' (m :: * -&gt; *) a s b r.
(Monad n, Monoid w, Monoid w') =&gt;
(m (a, s, w) -&gt; n (b, s, w')) -&gt; RWST r w s m a -&gt; RWST r w' s n b
</span><a href="Control.Monad.Trans.RWS.CPS.html#mapRWST"><span class="hs-identifier hs-var">mapRWST</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(b, s, w') -&gt; Identity (b, s, w')
forall a. a -&gt; Identity a
</span><a href="../../base/src/Data.Functor.Identity.html#Identity"><span class="hs-identifier hs-var">Identity</span></a></span><span> </span><span class="annot"><span class="annottext">((b, s, w') -&gt; Identity (b, s, w'))
-&gt; (Identity (a, s, w) -&gt; (b, s, w'))
-&gt; Identity (a, s, w)
-&gt; Identity (b, s, w')
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(a, s, w) -&gt; (b, s, w')
</span><a href="#local-6989586621679077907"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">((a, s, w) -&gt; (b, s, w'))
-&gt; (Identity (a, s, w) -&gt; (a, s, w))
-&gt; Identity (a, s, w)
-&gt; (b, s, w')
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Identity (a, s, w) -&gt; (a, s, w)
forall a. Identity a -&gt; a
</span><a href="../../base/src/Data.Functor.Identity.html#runIdentity"><span class="hs-identifier hs-var hs-var">runIdentity</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-131"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#mapRWS"><span class="hs-pragma hs-type">mapRWS</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-132"></span><span>
</span><span id="line-133"></span><span class="hs-comment">-- | @'withRWS' f m@ executes action @m@ with an initial environment</span><span>
</span><span id="line-134"></span><span class="hs-comment">-- and state modified by applying @f@.</span><span>
</span><span id="line-135"></span><span class="hs-comment">--</span><span>
</span><span id="line-136"></span><span class="hs-comment">-- * @'runRWS' ('withRWS' f m) r s = 'uncurry' ('runRWS' m) (f r s)@</span><span>
</span><span id="line-137"></span><span id="local-6989586621679078354"><span id="local-6989586621679078355"><span id="local-6989586621679078356"><span id="local-6989586621679078357"><span id="local-6989586621679078358"><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#withRWS"><span class="hs-identifier hs-type">withRWS</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679078358"><span class="hs-identifier hs-type">r'</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679078357"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679078356"><span class="hs-identifier hs-type">r</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679078357"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWS"><span class="hs-identifier hs-type">RWS</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078356"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078355"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078357"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078354"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWS"><span class="hs-identifier hs-type">RWS</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078358"><span class="hs-identifier hs-type">r'</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078355"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078357"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078354"><span class="hs-identifier hs-type">a</span></a></span></span></span></span></span></span><span>
</span><span id="line-138"></span><span id="withRWS"><span class="annot"><span class="annottext">withRWS :: forall r' s r w a.
(r' -&gt; s -&gt; (r, s)) -&gt; RWS r w s a -&gt; RWS r' w s a
</span><a href="Control.Monad.Trans.RWS.CPS.html#withRWS"><span class="hs-identifier hs-var hs-var">withRWS</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(r' -&gt; s -&gt; (r, s))
-&gt; RWST r w s Identity a -&gt; RWST r' w s Identity a
forall r' s r w (m :: * -&gt; *) a.
(r' -&gt; s -&gt; (r, s)) -&gt; RWST r w s m a -&gt; RWST r' w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#withRWST"><span class="hs-identifier hs-var">withRWST</span></a></span><span>
</span><span id="line-139"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#withRWS"><span class="hs-pragma hs-type">withRWS</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-140"></span><span>
</span><span id="line-141"></span><span class="hs-comment">-- ---------------------------------------------------------------------------</span><span>
</span><span id="line-142"></span><span class="hs-comment">-- | A monad transformer adding reading an environment of type @r@,</span><span>
</span><span id="line-143"></span><span class="hs-comment">-- collecting an output of type @w@ and updating a state of type @s@</span><span>
</span><span id="line-144"></span><span class="hs-comment">-- to an inner monad @m@.</span><span>
</span><span id="line-145"></span><span class="hs-keyword">newtype</span><span> </span><span id="RWST"><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-var">RWST</span></a></span></span><span> </span><span id="local-6989586621679078426"><span class="annot"><a href="#local-6989586621679078426"><span class="hs-identifier hs-type">r</span></a></span></span><span> </span><span id="local-6989586621679078424"><span class="annot"><a href="#local-6989586621679078424"><span class="hs-identifier hs-type">w</span></a></span></span><span> </span><span id="local-6989586621679078425"><span class="annot"><a href="#local-6989586621679078425"><span class="hs-identifier hs-type">s</span></a></span></span><span> </span><span id="local-6989586621679078423"><span class="annot"><a href="#local-6989586621679078423"><span class="hs-identifier hs-type">m</span></a></span></span><span> </span><span id="local-6989586621679078422"><span class="annot"><a href="#local-6989586621679078422"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="RWST"><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-var">RWST</span></a></span></span><span> </span><span class="hs-special">{</span><span> </span><span id="unRWST"><span class="annot"><span class="annottext">forall r w s (m :: * -&gt; *) a.
RWST r w s m a -&gt; r -&gt; s -&gt; w -&gt; m (a, s, w)
</span><a href="Control.Monad.Trans.RWS.CPS.html#unRWST"><span class="hs-identifier hs-var hs-var">unRWST</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621679078426"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679078425"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679078424"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679078423"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679078422"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679078425"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679078424"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-146"></span><span>
</span><span id="line-147"></span><span class="hs-comment">-- | Construct an RWST computation from a function.</span><span>
</span><span id="line-148"></span><span class="hs-comment">-- (The inverse of 'runRWST'.)</span><span>
</span><span id="line-149"></span><span id="local-6989586621679078333"><span id="local-6989586621679078334"><span id="local-6989586621679078335"><span id="local-6989586621679078336"><span id="local-6989586621679078337"><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#rwsT"><span class="hs-identifier hs-type">rwsT</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078337"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078336"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679078335"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679078334"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679078337"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679078333"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679078334"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679078336"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078335"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078336"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078334"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078337"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078333"><span class="hs-identifier hs-type">a</span></a></span></span></span></span></span></span><span>
</span><span id="line-150"></span><span id="rwsT"><span class="annot"><span class="annottext">rwsT :: forall (m :: * -&gt; *) w r s a.
(Functor m, Monoid w) =&gt;
(r -&gt; s -&gt; m (a, s, w)) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#rwsT"><span class="hs-identifier hs-var hs-var">rwsT</span></a></span></span><span> </span><span id="local-6989586621679077900"><span class="annot"><span class="annottext">r -&gt; s -&gt; m (a, s, w)
</span><a href="#local-6989586621679077900"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
forall r w s (m :: * -&gt; *) a.
(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-var">RWST</span></a></span><span> </span><span class="annot"><span class="annottext">((r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a)
-&gt; (r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679077899"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077899"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span id="local-6989586621679077898"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077898"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679077897"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077897"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-151"></span><span>     </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679077896"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679077896"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679077895"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077895"><span class="hs-identifier hs-var">s'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679077894"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077894"><span class="hs-identifier hs-var">w'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679077892"><span class="annot"><span class="annottext">wt :: w
</span><a href="#local-6989586621679077892"><span class="hs-identifier hs-var hs-var">wt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077897"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">w -&gt; w -&gt; w
forall a. Monoid a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#mappend"><span class="hs-operator hs-var">`mappend`</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077894"><span class="hs-identifier hs-var">w'</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077892"><span class="hs-identifier hs-var">wt</span></a></span><span> </span><span class="annot"><span class="annottext">w -&gt; (a, s, w) -&gt; (a, s, w)
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679077896"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077895"><span class="hs-identifier hs-var">s'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077892"><span class="hs-identifier hs-var">wt</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">((a, s, w) -&gt; (a, s, w)) -&gt; m (a, s, w) -&gt; m (a, s, w)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">r -&gt; s -&gt; m (a, s, w)
</span><a href="#local-6989586621679077900"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077899"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077898"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-152"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#rwsT"><span class="hs-pragma hs-type">rwsT</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-153"></span><span>
</span><span id="line-154"></span><span class="hs-comment">-- | Unwrap an RWST computation as a function.</span><span>
</span><span id="line-155"></span><span class="hs-comment">-- (The inverse of 'rwsT'.)</span><span>
</span><span id="line-156"></span><span id="local-6989586621679078399"><span id="local-6989586621679078400"><span id="local-6989586621679078401"><span id="local-6989586621679078402"><span id="local-6989586621679078403"><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#runRWST"><span class="hs-identifier hs-type">runRWST</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078403"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078402"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078403"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078401"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078400"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078399"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679078402"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679078401"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679078400"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679078399"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679078401"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679078403"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span></span></span></span></span></span><span>
</span><span id="line-157"></span><span id="runRWST"><span class="annot"><span class="annottext">runRWST :: forall w r s (m :: * -&gt; *) a.
Monoid w =&gt;
RWST r w s m a -&gt; r -&gt; s -&gt; m (a, s, w)
</span><a href="Control.Monad.Trans.RWS.CPS.html#runRWST"><span class="hs-identifier hs-var hs-var">runRWST</span></a></span></span><span> </span><span id="local-6989586621679077888"><span class="annot"><span class="annottext">RWST r w s m a
</span><a href="#local-6989586621679077888"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679077887"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077887"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span id="local-6989586621679077886"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077886"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RWST r w s m a -&gt; r -&gt; s -&gt; w -&gt; m (a, s, w)
forall r w s (m :: * -&gt; *) a.
RWST r w s m a -&gt; r -&gt; s -&gt; w -&gt; m (a, s, w)
</span><a href="Control.Monad.Trans.RWS.CPS.html#unRWST"><span class="hs-identifier hs-var hs-var">unRWST</span></a></span><span> </span><span class="annot"><span class="annottext">RWST r w s m a
</span><a href="#local-6989586621679077888"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077887"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077886"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">w
forall a. Monoid a =&gt; a
</span><a href="../../base/src/GHC.Base.html#mempty"><span class="hs-identifier hs-var">mempty</span></a></span><span>
</span><span id="line-158"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#runRWST"><span class="hs-pragma hs-type">runRWST</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-159"></span><span>
</span><span id="line-160"></span><span class="hs-comment">-- | Evaluate a computation with the given initial state and environment,</span><span>
</span><span id="line-161"></span><span class="hs-comment">-- returning the final value and output, discarding the final state.</span><span>
</span><span id="line-162"></span><span id="local-6989586621679078315"><span id="local-6989586621679078316"><span id="local-6989586621679078317"><span id="local-6989586621679078318"><span id="local-6989586621679078319"><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#evalRWST"><span class="hs-identifier hs-type">evalRWST</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078319"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078318"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-163"></span><span>         </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078317"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078318"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078316"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078319"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078315"><span class="hs-identifier hs-type">a</span></a></span><span>      </span><span class="hs-comment">-- ^computation to execute</span><span>
</span><span id="line-164"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679078317"><span class="hs-identifier hs-type">r</span></a></span><span>                   </span><span class="hs-comment">-- ^initial environment</span><span>
</span><span id="line-165"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679078316"><span class="hs-identifier hs-type">s</span></a></span><span>                   </span><span class="hs-comment">-- ^initial value</span><span>
</span><span id="line-166"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679078319"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679078315"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679078318"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span></span></span></span></span></span><span>            </span><span class="hs-comment">-- ^computation yielding final value and output</span><span>
</span><span id="line-167"></span><span id="evalRWST"><span class="annot"><span class="annottext">evalRWST :: forall (m :: * -&gt; *) w r s a.
(Monad m, Monoid w) =&gt;
RWST r w s m a -&gt; r -&gt; s -&gt; m (a, w)
</span><a href="Control.Monad.Trans.RWS.CPS.html#evalRWST"><span class="hs-identifier hs-var hs-var">evalRWST</span></a></span></span><span> </span><span id="local-6989586621679077880"><span class="annot"><span class="annottext">RWST r w s m a
</span><a href="#local-6989586621679077880"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679077879"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077879"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span id="local-6989586621679077878"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077878"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-168"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621679077877"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679077877"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">s
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679077876"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077876"><span class="hs-identifier hs-var">w</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RWST r w s m a -&gt; r -&gt; s -&gt; m (a, s, w)
forall w r s (m :: * -&gt; *) a.
Monoid w =&gt;
RWST r w s m a -&gt; r -&gt; s -&gt; m (a, s, w)
</span><a href="Control.Monad.Trans.RWS.CPS.html#runRWST"><span class="hs-identifier hs-var">runRWST</span></a></span><span> </span><span class="annot"><span class="annottext">RWST r w s m a
</span><a href="#local-6989586621679077880"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077879"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077878"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-169"></span><span>    </span><span class="annot"><span class="annottext">(a, w) -&gt; m (a, w)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679077877"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077876"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-170"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#evalRWST"><span class="hs-pragma hs-type">evalRWST</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-171"></span><span>
</span><span id="line-172"></span><span class="hs-comment">-- | Evaluate a computation with the given initial state and environment,</span><span>
</span><span id="line-173"></span><span class="hs-comment">-- returning the final state and output, discarding the final value.</span><span>
</span><span id="line-174"></span><span id="local-6989586621679078305"><span id="local-6989586621679078306"><span id="local-6989586621679078307"><span id="local-6989586621679078308"><span id="local-6989586621679078309"><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#execRWST"><span class="hs-identifier hs-type">execRWST</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078309"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078308"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-175"></span><span>         </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078307"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078308"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078306"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078309"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078305"><span class="hs-identifier hs-type">a</span></a></span><span>      </span><span class="hs-comment">-- ^computation to execute</span><span>
</span><span id="line-176"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679078307"><span class="hs-identifier hs-type">r</span></a></span><span>                   </span><span class="hs-comment">-- ^initial environment</span><span>
</span><span id="line-177"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679078306"><span class="hs-identifier hs-type">s</span></a></span><span>                   </span><span class="hs-comment">-- ^initial value</span><span>
</span><span id="line-178"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679078309"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679078306"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679078308"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span></span></span></span></span></span><span>            </span><span class="hs-comment">-- ^computation yielding final state and output</span><span>
</span><span id="line-179"></span><span id="execRWST"><span class="annot"><span class="annottext">execRWST :: forall (m :: * -&gt; *) w r s a.
(Monad m, Monoid w) =&gt;
RWST r w s m a -&gt; r -&gt; s -&gt; m (s, w)
</span><a href="Control.Monad.Trans.RWS.CPS.html#execRWST"><span class="hs-identifier hs-var hs-var">execRWST</span></a></span></span><span> </span><span id="local-6989586621679077870"><span class="annot"><span class="annottext">RWST r w s m a
</span><a href="#local-6989586621679077870"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679077869"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077869"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span id="local-6989586621679077868"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077868"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-180"></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679077867"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077867"><span class="hs-identifier hs-var">s'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679077866"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077866"><span class="hs-identifier hs-var">w</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RWST r w s m a -&gt; r -&gt; s -&gt; m (a, s, w)
forall w r s (m :: * -&gt; *) a.
Monoid w =&gt;
RWST r w s m a -&gt; r -&gt; s -&gt; m (a, s, w)
</span><a href="Control.Monad.Trans.RWS.CPS.html#runRWST"><span class="hs-identifier hs-var">runRWST</span></a></span><span> </span><span class="annot"><span class="annottext">RWST r w s m a
</span><a href="#local-6989586621679077870"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077869"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077868"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-181"></span><span>    </span><span class="annot"><span class="annottext">(s, w) -&gt; m (s, w)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077867"><span class="hs-identifier hs-var">s'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077866"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-182"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#execRWST"><span class="hs-pragma hs-type">execRWST</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-183"></span><span>
</span><span id="line-184"></span><span class="hs-comment">-- | Map the inner computation using the given function.</span><span>
</span><span id="line-185"></span><span class="hs-comment">--</span><span>
</span><span id="line-186"></span><span class="hs-comment">-- * @'runRWST' ('mapRWST' f m) r s = f ('runRWST' m r s)@</span><span>
</span><span id="line-187"></span><span class="hs-comment">--mapRWST :: (m (a, s, w) -&gt; n (b, s, w')) -&gt; RWST r w s m a -&gt; RWST r w' s n b</span><span>
</span><span id="line-188"></span><span id="local-6989586621679078363"><span id="local-6989586621679078364"><span id="local-6989586621679078365"><span id="local-6989586621679078366"><span id="local-6989586621679078367"><span id="local-6989586621679078368"><span id="local-6989586621679078369"><span id="local-6989586621679078370"><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#mapRWST"><span class="hs-identifier hs-type">mapRWST</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078370"><span class="hs-identifier hs-type">n</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078369"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078368"><span class="hs-identifier hs-type">w'</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span>
</span><span id="line-189"></span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679078367"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679078366"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679078365"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679078369"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679078370"><span class="hs-identifier hs-type">n</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679078364"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679078365"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679078368"><span class="hs-identifier hs-type">w'</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078363"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078369"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078365"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078367"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078366"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078363"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078368"><span class="hs-identifier hs-type">w'</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078365"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078370"><span class="hs-identifier hs-type">n</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078364"><span class="hs-identifier hs-type">b</span></a></span></span></span></span></span></span></span></span></span><span>
</span><span id="line-190"></span><span id="mapRWST"><span class="annot"><span class="annottext">mapRWST :: forall (n :: * -&gt; *) w w' (m :: * -&gt; *) a s b r.
(Monad n, Monoid w, Monoid w') =&gt;
(m (a, s, w) -&gt; n (b, s, w')) -&gt; RWST r w s m a -&gt; RWST r w' s n b
</span><a href="Control.Monad.Trans.RWS.CPS.html#mapRWST"><span class="hs-identifier hs-var hs-var">mapRWST</span></a></span></span><span> </span><span id="local-6989586621679077859"><span class="annot"><span class="annottext">m (a, s, w) -&gt; n (b, s, w')
</span><a href="#local-6989586621679077859"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679077858"><span class="annot"><span class="annottext">RWST r w s m a
</span><a href="#local-6989586621679077858"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(r -&gt; s -&gt; w' -&gt; n (b, s, w')) -&gt; RWST r w' s n b
forall r w s (m :: * -&gt; *) a.
(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-var">RWST</span></a></span><span> </span><span class="annot"><span class="annottext">((r -&gt; s -&gt; w' -&gt; n (b, s, w')) -&gt; RWST r w' s n b)
-&gt; (r -&gt; s -&gt; w' -&gt; n (b, s, w')) -&gt; RWST r w' s n b
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679077857"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077857"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span id="local-6989586621679077856"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077856"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679077855"><span class="annot"><span class="annottext">w'
</span><a href="#local-6989586621679077855"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-191"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621679077854"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679077854"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679077853"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077853"><span class="hs-identifier hs-var">s'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679077852"><span class="annot"><span class="annottext">w'
</span><a href="#local-6989586621679077852"><span class="hs-identifier hs-var">w'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">m (a, s, w) -&gt; n (b, s, w')
</span><a href="#local-6989586621679077859"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RWST r w s m a -&gt; r -&gt; s -&gt; m (a, s, w)
forall w r s (m :: * -&gt; *) a.
Monoid w =&gt;
RWST r w s m a -&gt; r -&gt; s -&gt; m (a, s, w)
</span><a href="Control.Monad.Trans.RWS.CPS.html#runRWST"><span class="hs-identifier hs-var">runRWST</span></a></span><span> </span><span class="annot"><span class="annottext">RWST r w s m a
</span><a href="#local-6989586621679077858"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077857"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077856"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-192"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679077850"><span class="annot"><span class="annottext">wt :: w'
</span><a href="#local-6989586621679077850"><span class="hs-identifier hs-var hs-var">wt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">w'
</span><a href="#local-6989586621679077855"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">w' -&gt; w' -&gt; w'
forall a. Monoid a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#mappend"><span class="hs-operator hs-var">`mappend`</span></a></span><span> </span><span class="annot"><span class="annottext">w'
</span><a href="#local-6989586621679077852"><span class="hs-identifier hs-var">w'</span></a></span><span>
</span><span id="line-193"></span><span>    </span><span class="annot"><span class="annottext">w'
</span><a href="#local-6989586621679077850"><span class="hs-identifier hs-var">wt</span></a></span><span> </span><span class="annot"><span class="annottext">w' -&gt; n (b, s, w') -&gt; n (b, s, w')
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">(b, s, w') -&gt; n (b, s, w')
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621679077854"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077853"><span class="hs-identifier hs-var">s'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w'
</span><a href="#local-6989586621679077850"><span class="hs-identifier hs-var">wt</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-194"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#mapRWST"><span class="hs-pragma hs-type">mapRWST</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-195"></span><span>
</span><span id="line-196"></span><span class="hs-comment">-- | @'withRWST' f m@ executes action @m@ with an initial environment</span><span>
</span><span id="line-197"></span><span class="hs-comment">-- and state modified by applying @f@.</span><span>
</span><span id="line-198"></span><span class="hs-comment">--</span><span>
</span><span id="line-199"></span><span class="hs-comment">-- * @'runRWST' ('withRWST' f m) r s = 'uncurry' ('runRWST' m) (f r s)@</span><span>
</span><span id="line-200"></span><span id="local-6989586621679078343"><span id="local-6989586621679078344"><span id="local-6989586621679078345"><span id="local-6989586621679078346"><span id="local-6989586621679078347"><span id="local-6989586621679078348"><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#withRWST"><span class="hs-identifier hs-type">withRWST</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679078348"><span class="hs-identifier hs-type">r'</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679078347"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679078346"><span class="hs-identifier hs-type">r</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679078347"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078346"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078345"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078347"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078344"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078343"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078348"><span class="hs-identifier hs-type">r'</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078345"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078347"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078344"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078343"><span class="hs-identifier hs-type">a</span></a></span></span></span></span></span></span></span><span>
</span><span id="line-201"></span><span id="withRWST"><span class="annot"><span class="annottext">withRWST :: forall r' s r w (m :: * -&gt; *) a.
(r' -&gt; s -&gt; (r, s)) -&gt; RWST r w s m a -&gt; RWST r' w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#withRWST"><span class="hs-identifier hs-var hs-var">withRWST</span></a></span></span><span> </span><span id="local-6989586621679077849"><span class="annot"><span class="annottext">r' -&gt; s -&gt; (r, s)
</span><a href="#local-6989586621679077849"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679077848"><span class="annot"><span class="annottext">RWST r w s m a
</span><a href="#local-6989586621679077848"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(r' -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r' w s m a
forall r w s (m :: * -&gt; *) a.
(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-var">RWST</span></a></span><span> </span><span class="annot"><span class="annottext">((r' -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r' w s m a)
-&gt; (r' -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r' w s m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679077847"><span class="annot"><span class="annottext">r'
</span><a href="#local-6989586621679077847"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span id="local-6989586621679077846"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077846"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; (r, s) -&gt; w -&gt; m (a, s, w)
forall a b c. (a -&gt; b -&gt; c) -&gt; (a, b) -&gt; c
</span><a href="../../base/src/Data.Tuple.html#uncurry"><span class="hs-identifier hs-var">uncurry</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RWST r w s m a -&gt; r -&gt; s -&gt; w -&gt; m (a, s, w)
forall r w s (m :: * -&gt; *) a.
RWST r w s m a -&gt; r -&gt; s -&gt; w -&gt; m (a, s, w)
</span><a href="Control.Monad.Trans.RWS.CPS.html#unRWST"><span class="hs-identifier hs-var hs-var">unRWST</span></a></span><span> </span><span class="annot"><span class="annottext">RWST r w s m a
</span><a href="#local-6989586621679077848"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">r' -&gt; s -&gt; (r, s)
</span><a href="#local-6989586621679077849"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">r'
</span><a href="#local-6989586621679077847"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077846"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-202"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#withRWST"><span class="hs-pragma hs-type">withRWST</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-203"></span><span>
</span><span id="line-204"></span><span id="local-6989586621679078274"><span id="local-6989586621679078275"><span id="local-6989586621679078276"><span id="local-6989586621679078277"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679077842"><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078277"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078276"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078275"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078274"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078277"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-205"></span><span>    </span><span id="local-6989586621679077839"><span class="annot"><span class="annottext">fmap :: forall a b. (a -&gt; b) -&gt; RWST r w s m a -&gt; RWST r w s m b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var hs-var hs-var hs-var">fmap</span></a></span></span><span> </span><span id="local-6989586621679077838"><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679077838"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679077837"><span class="annot"><span class="annottext">RWST r w s m a
</span><a href="#local-6989586621679077837"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(r -&gt; s -&gt; w -&gt; m (b, s, w)) -&gt; RWST r w s m b
forall r w s (m :: * -&gt; *) a.
(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-var">RWST</span></a></span><span> </span><span class="annot"><span class="annottext">((r -&gt; s -&gt; w -&gt; m (b, s, w)) -&gt; RWST r w s m b)
-&gt; (r -&gt; s -&gt; w -&gt; m (b, s, w)) -&gt; RWST r w s m b
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679077836"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077836"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span id="local-6989586621679077835"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077835"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679077834"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077834"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679077833"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679077833"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679077832"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077832"><span class="hs-identifier hs-var">s'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679077831"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077831"><span class="hs-identifier hs-var">w'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679077838"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679077833"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077832"><span class="hs-identifier hs-var">s'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077831"><span class="hs-identifier hs-var">w'</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">((a, s, w) -&gt; (b, s, w)) -&gt; m (a, s, w) -&gt; m (b, s, w)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">RWST r w s m a -&gt; r -&gt; s -&gt; w -&gt; m (a, s, w)
forall r w s (m :: * -&gt; *) a.
RWST r w s m a -&gt; r -&gt; s -&gt; w -&gt; m (a, s, w)
</span><a href="Control.Monad.Trans.RWS.CPS.html#unRWST"><span class="hs-identifier hs-var hs-var">unRWST</span></a></span><span> </span><span class="annot"><span class="annottext">RWST r w s m a
</span><a href="#local-6989586621679077837"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077836"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077835"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077834"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-206"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-pragma hs-type">fmap</span></a></span><span> </span><span class="hs-pragma">#-}</span></span></span></span></span><span>
</span><span id="line-207"></span><span>
</span><span id="line-208"></span><span id="local-6989586621679078257"><span id="local-6989586621679078258"><span id="local-6989586621679078259"><span id="local-6989586621679078260"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679077821"><span id="local-6989586621679077823"><span id="local-6989586621679077825"><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078260"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078260"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Applicative"><span class="hs-identifier hs-type">Applicative</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078259"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078258"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078257"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078260"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-209"></span><span>    </span><span id="local-6989586621679077818"><span class="annot"><span class="annottext">pure :: forall a. a -&gt; RWST r w s m a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var hs-var hs-var hs-var">pure</span></a></span></span><span> </span><span id="local-6989586621679077817"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679077817"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
forall r w s (m :: * -&gt; *) a.
(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-var">RWST</span></a></span><span> </span><span class="annot"><span class="annottext">((r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a)
-&gt; (r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span class="annot"><span class="annottext">r
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679077816"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077816"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679077815"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077815"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(a, s, w) -&gt; m (a, s, w)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679077817"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077816"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077815"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-210"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#pure"><span class="hs-pragma hs-type">pure</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-211"></span><span>
</span><span id="line-212"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span id="local-6989586621679077811"><span class="annot"><span class="annottext">r -&gt; s -&gt; w -&gt; m (a -&gt; b, s, w)
</span><a href="#local-6989586621679077811"><span class="hs-identifier hs-var">mf</span></a></span></span><span> </span><span id="local-6989586621679077810"><span class="annot"><span class="annottext">&lt;*&gt; :: forall a b.
RWST r w s m (a -&gt; b) -&gt; RWST r w s m a -&gt; RWST r w s m b
</span><a href="../../base/src/GHC.Base.html#%3C%2A%3E"><span class="hs-operator hs-var hs-var hs-var hs-var">&lt;*&gt;</span></a></span></span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span id="local-6989586621679077809"><span class="annot"><span class="annottext">r -&gt; s -&gt; w -&gt; m (a, s, w)
</span><a href="#local-6989586621679077809"><span class="hs-identifier hs-var">mx</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(r -&gt; s -&gt; w -&gt; m (b, s, w)) -&gt; RWST r w s m b
forall r w s (m :: * -&gt; *) a.
(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-var">RWST</span></a></span><span> </span><span class="annot"><span class="annottext">((r -&gt; s -&gt; w -&gt; m (b, s, w)) -&gt; RWST r w s m b)
-&gt; (r -&gt; s -&gt; w -&gt; m (b, s, w)) -&gt; RWST r w s m b
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679077808"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077808"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span id="local-6989586621679077807"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077807"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679077806"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077806"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-213"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621679077805"><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679077805"><span class="hs-identifier hs-var">f</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679077804"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077804"><span class="hs-identifier hs-var">s'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679077803"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077803"><span class="hs-identifier hs-var">w'</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">r -&gt; s -&gt; w -&gt; m (a -&gt; b, s, w)
</span><a href="#local-6989586621679077811"><span class="hs-identifier hs-var">mf</span></a></span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077808"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077807"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077806"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-214"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621679077802"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679077802"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679077801"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077801"><span class="hs-identifier hs-var">s''</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679077800"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077800"><span class="hs-identifier hs-var">w''</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">r -&gt; s -&gt; w -&gt; m (a, s, w)
</span><a href="#local-6989586621679077809"><span class="hs-identifier hs-var">mx</span></a></span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077808"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077804"><span class="hs-identifier hs-var">s'</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077803"><span class="hs-identifier hs-var">w'</span></a></span><span>
</span><span id="line-215"></span><span>        </span><span class="annot"><span class="annottext">(b, s, w) -&gt; m (b, s, w)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; b
</span><a href="#local-6989586621679077805"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679077802"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077801"><span class="hs-identifier hs-var">s''</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077800"><span class="hs-identifier hs-var">w''</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-216"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">&lt;*&gt;</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">#-}</span></span></span></span></span><span>
</span><span id="line-217"></span><span>
</span><span id="line-218"></span><span id="local-6989586621679078245"><span id="local-6989586621679078246"><span id="local-6989586621679078247"><span id="local-6989586621679078248"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679077792"><span id="local-6989586621679077794"><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078248"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#MonadPlus"><span class="hs-identifier hs-type">MonadPlus</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078248"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Alternative"><span class="hs-identifier hs-type">Alternative</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078247"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078246"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078245"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078248"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-219"></span><span>    </span><span id="local-6989586621679077789"><span class="annot"><span class="annottext">empty :: forall a. RWST r w s m a
</span><a href="../../base/src/GHC.Base.html#empty"><span class="hs-identifier hs-var hs-var hs-var hs-var">empty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
forall r w s (m :: * -&gt; *) a.
(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-var">RWST</span></a></span><span> </span><span class="annot"><span class="annottext">((r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a)
-&gt; (r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span class="annot"><span class="annottext">r
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">s
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">w
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">m (a, s, w)
forall (m :: * -&gt; *) a. MonadPlus m =&gt; m a
</span><a href="../../base/src/GHC.Base.html#mzero"><span class="hs-identifier hs-var">mzero</span></a></span><span>
</span><span id="line-220"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#empty"><span class="hs-pragma hs-type">empty</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-221"></span><span>
</span><span id="line-222"></span><span>    </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span id="local-6989586621679077785"><span class="annot"><span class="annottext">r -&gt; s -&gt; w -&gt; m (a, s, w)
</span><a href="#local-6989586621679077785"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679077784"><span class="annot"><span class="annottext">&lt;|&gt; :: forall a. RWST r w s m a -&gt; RWST r w s m a -&gt; RWST r w s m a
</span><a href="../../base/src/GHC.Base.html#%3C%7C%3E"><span class="hs-operator hs-var hs-var hs-var hs-var">&lt;|&gt;</span></a></span></span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span id="local-6989586621679077782"><span class="annot"><span class="annottext">r -&gt; s -&gt; w -&gt; m (a, s, w)
</span><a href="#local-6989586621679077782"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
forall r w s (m :: * -&gt; *) a.
(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-var">RWST</span></a></span><span> </span><span class="annot"><span class="annottext">((r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a)
-&gt; (r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679077781"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077781"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span id="local-6989586621679077780"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077780"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679077779"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077779"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">r -&gt; s -&gt; w -&gt; m (a, s, w)
</span><a href="#local-6989586621679077785"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077781"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077780"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077779"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">m (a, s, w) -&gt; m (a, s, w) -&gt; m (a, s, w)
forall (m :: * -&gt; *) a. MonadPlus m =&gt; m a -&gt; m a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#mplus"><span class="hs-operator hs-var">`mplus`</span></a></span><span> </span><span class="annot"><span class="annottext">r -&gt; s -&gt; w -&gt; m (a, s, w)
</span><a href="#local-6989586621679077782"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077781"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077780"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077779"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-223"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">&lt;|&gt;</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">#-}</span></span></span></span></span><span>
</span><span id="line-224"></span><span>
</span><span id="line-225"></span><span id="local-6989586621679078233"><span id="local-6989586621679078234"><span id="local-6989586621679078235"><span id="local-6989586621679078236"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679077771"><span id="local-6989586621679077773"><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078236"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078235"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078234"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078233"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078236"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span></span></span><span> </span><span class="hs-keyword">where</span><span class="hs-cpp">
#if !(MIN_VERSION_base(4,8,0))
</span><span>    </span><span class="hs-identifier">return</span><span> </span><span class="hs-identifier">a</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">RWST</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">s</span><span> </span><span class="hs-identifier">w</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">return</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">a</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">s</span><span class="hs-special">,</span><span> </span><span class="hs-identifier">w</span><span class="hs-special">)</span><span>
</span><span id="line-228"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">return</span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-231"></span><span>    </span><span id="local-6989586621679077768"><span class="annot"><span class="annottext">RWST r w s m a
</span><a href="#local-6989586621679077768"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679077767"><span class="annot"><span class="annottext">&gt;&gt;= :: forall a b.
RWST r w s m a -&gt; (a -&gt; RWST r w s m b) -&gt; RWST r w s m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-operator hs-var hs-var hs-var hs-var">&gt;&gt;=</span></a></span></span><span> </span><span id="local-6989586621679077766"><span class="annot"><span class="annottext">a -&gt; RWST r w s m b
</span><a href="#local-6989586621679077766"><span class="hs-identifier hs-var">k</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(r -&gt; s -&gt; w -&gt; m (b, s, w)) -&gt; RWST r w s m b
forall r w s (m :: * -&gt; *) a.
(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-var">RWST</span></a></span><span> </span><span class="annot"><span class="annottext">((r -&gt; s -&gt; w -&gt; m (b, s, w)) -&gt; RWST r w s m b)
-&gt; (r -&gt; s -&gt; w -&gt; m (b, s, w)) -&gt; RWST r w s m b
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679077765"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077765"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span id="local-6989586621679077764"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077764"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679077763"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077763"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-232"></span><span>        </span><span class="hs-special">(</span><span id="local-6989586621679077762"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679077762"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679077761"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077761"><span class="hs-identifier hs-var">s'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679077760"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077760"><span class="hs-identifier hs-var">w'</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RWST r w s m a -&gt; r -&gt; s -&gt; w -&gt; m (a, s, w)
forall r w s (m :: * -&gt; *) a.
RWST r w s m a -&gt; r -&gt; s -&gt; w -&gt; m (a, s, w)
</span><a href="Control.Monad.Trans.RWS.CPS.html#unRWST"><span class="hs-identifier hs-var hs-var">unRWST</span></a></span><span> </span><span class="annot"><span class="annottext">RWST r w s m a
</span><a href="#local-6989586621679077768"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077765"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077764"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077763"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-233"></span><span>        </span><span class="annot"><span class="annottext">RWST r w s m b -&gt; r -&gt; s -&gt; w -&gt; m (b, s, w)
forall r w s (m :: * -&gt; *) a.
RWST r w s m a -&gt; r -&gt; s -&gt; w -&gt; m (a, s, w)
</span><a href="Control.Monad.Trans.RWS.CPS.html#unRWST"><span class="hs-identifier hs-var hs-var">unRWST</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; RWST r w s m b
</span><a href="#local-6989586621679077766"><span class="hs-identifier hs-var">k</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679077762"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077765"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077761"><span class="hs-identifier hs-var">s'</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077760"><span class="hs-identifier hs-var">w'</span></a></span><span>
</span><span id="line-234"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">(</span><span class="hs-pragma">&gt;&gt;=</span><span class="hs-pragma">)</span><span> </span><span class="hs-pragma">#-}</span></span></span></span></span><span class="hs-cpp">

#if !(MIN_VERSION_base(4,13,0))
</span><span>    </span><span class="hs-identifier">fail</span><span> </span><span class="hs-identifier">msg</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">RWST</span><span> </span><span class="hs-operator">$</span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-identifier">_</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-identifier">fail</span><span> </span><span class="hs-identifier">msg</span><span>
</span><span id="line-238"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="hs-pragma">fail</span><span> </span><span class="hs-pragma">#-}</span><span class="hs-cpp">
#endif
</span><span class="hs-cpp">
#if MIN_VERSION_base(4,9,0)
</span><span id="local-6989586621679078221"><span id="local-6989586621679078222"><span id="local-6989586621679078223"><span id="local-6989586621679078224"><span class="hs-keyword">instance</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Control.Monad.Fail.html#MonadFail"><span class="hs-identifier hs-type">Fail.MonadFail</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078224"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.Fail.html#MonadFail"><span class="hs-identifier hs-type">Fail.MonadFail</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078223"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078222"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078221"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078224"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-243"></span><span>    </span><span id="local-6989586621679077750"><span class="annot"><span class="annottext">fail :: forall a. String -&gt; RWST r w s m a
</span><a href="../../base/src/Control.Monad.Fail.html#fail"><span class="hs-identifier hs-var hs-var hs-var hs-var">fail</span></a></span></span><span> </span><span id="local-6989586621679077749"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679077749"><span class="hs-identifier hs-var">msg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
forall r w s (m :: * -&gt; *) a.
(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-var">RWST</span></a></span><span> </span><span class="annot"><span class="annottext">((r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a)
-&gt; (r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span class="annot"><span class="annottext">r
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">s
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">w
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; m (a, s, w)
forall (m :: * -&gt; *) a. MonadFail m =&gt; String -&gt; m a
</span><a href="../../base/src/Control.Monad.Fail.html#fail"><span class="hs-identifier hs-var">Fail.fail</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679077749"><span class="hs-identifier hs-var">msg</span></a></span><span>
</span><span id="line-244"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.Fail.html#fail"><span class="hs-pragma hs-type">fail</span></a></span><span> </span><span class="hs-pragma">#-}</span></span></span></span></span><span class="hs-cpp">
#endif
</span><span>
</span><span id="line-247"></span><span id="local-6989586621679078212"><span id="local-6989586621679078213"><span id="local-6989586621679078214"><span id="local-6989586621679078215"><span class="hs-keyword">instance</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Functor"><span class="hs-identifier hs-type">Functor</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078215"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#MonadPlus"><span class="hs-identifier hs-type">MonadPlus</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078215"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#MonadPlus"><span class="hs-identifier hs-type">MonadPlus</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078214"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078213"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078212"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078215"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-248"></span><span>    </span><span id="local-6989586621679077736"><span class="annot"><span class="annottext">mzero :: forall a. RWST r w s m a
</span><a href="#local-6989586621679077736"><span class="hs-identifier hs-var hs-var hs-var hs-var">mzero</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RWST r w s m a
forall (f :: * -&gt; *) a. Alternative f =&gt; f a
</span><a href="../../base/src/GHC.Base.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span>
</span><span id="line-249"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#mzero"><span class="hs-pragma hs-type">mzero</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-250"></span><span>    </span><span id="local-6989586621679077734"><span class="annot"><span class="annottext">mplus :: forall a. RWST r w s m a -&gt; RWST r w s m a -&gt; RWST r w s m a
</span><a href="#local-6989586621679077734"><span class="hs-identifier hs-var hs-var hs-var hs-var">mplus</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RWST r w s m a -&gt; RWST r w s m a -&gt; RWST r w s m a
forall (f :: * -&gt; *) a. Alternative f =&gt; f a -&gt; f a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#%3C%7C%3E"><span class="hs-operator hs-var">(&lt;|&gt;)</span></a></span><span>
</span><span id="line-251"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#mplus"><span class="hs-pragma hs-type">mplus</span></a></span><span> </span><span class="hs-pragma">#-}</span></span></span></span></span><span>
</span><span id="line-252"></span><span>
</span><span id="line-253"></span><span id="local-6989586621679078200"><span id="local-6989586621679078201"><span id="local-6989586621679078202"><span id="local-6989586621679078203"><span class="hs-keyword">instance</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Control.Monad.Fix.html#MonadFix"><span class="hs-identifier hs-type">MonadFix</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078203"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.Fix.html#MonadFix"><span class="hs-identifier hs-type">MonadFix</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078202"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078201"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078200"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078203"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-254"></span><span>    </span><span id="local-6989586621679077724"><span class="annot"><span class="annottext">mfix :: forall a. (a -&gt; RWST r w s m a) -&gt; RWST r w s m a
</span><a href="../../base/src/Control.Monad.Fix.html#mfix"><span class="hs-identifier hs-var hs-var hs-var hs-var">mfix</span></a></span></span><span> </span><span id="local-6989586621679077723"><span class="annot"><span class="annottext">a -&gt; RWST r w s m a
</span><a href="#local-6989586621679077723"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
forall r w s (m :: * -&gt; *) a.
(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-var">RWST</span></a></span><span> </span><span class="annot"><span class="annottext">((r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a)
-&gt; (r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679077722"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077722"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span id="local-6989586621679077721"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077721"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679077720"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077720"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">((a, s, w) -&gt; m (a, s, w)) -&gt; m (a, s, w)
forall (m :: * -&gt; *) a. MonadFix m =&gt; (a -&gt; m a) -&gt; m a
</span><a href="../../base/src/Control.Monad.Fix.html#mfix"><span class="hs-identifier hs-var">mfix</span></a></span><span> </span><span class="annot"><span class="annottext">(((a, s, w) -&gt; m (a, s, w)) -&gt; m (a, s, w))
-&gt; ((a, s, w) -&gt; m (a, s, w)) -&gt; m (a, s, w)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span class="hs-glyph">~</span><span class="hs-special">(</span><span id="local-6989586621679077719"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679077719"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">s
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">RWST r w s m a -&gt; r -&gt; s -&gt; w -&gt; m (a, s, w)
forall r w s (m :: * -&gt; *) a.
RWST r w s m a -&gt; r -&gt; s -&gt; w -&gt; m (a, s, w)
</span><a href="Control.Monad.Trans.RWS.CPS.html#unRWST"><span class="hs-identifier hs-var hs-var">unRWST</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; RWST r w s m a
</span><a href="#local-6989586621679077723"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679077719"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077722"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077721"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077720"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-255"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.Fix.html#mfix"><span class="hs-pragma hs-type">mfix</span></a></span><span> </span><span class="hs-pragma">#-}</span></span></span></span></span><span>
</span><span id="line-256"></span><span>
</span><span id="line-257"></span><span id="local-6989586621679078189"><span id="local-6989586621679078190"><span id="local-6989586621679078191"><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Class.html#MonadTrans"><span class="hs-identifier hs-type">MonadTrans</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078191"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078190"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078189"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-258"></span><span>    </span><span id="local-6989586621679077712"><span class="annot"><span class="annottext">lift :: forall (m :: * -&gt; *) a. Monad m =&gt; m a -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.Class.html#lift"><span class="hs-identifier hs-var hs-var hs-var hs-var">lift</span></a></span></span><span> </span><span id="local-6989586621679077710"><span class="annot"><span class="annottext">m a
</span><a href="#local-6989586621679077710"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
forall r w s (m :: * -&gt; *) a.
(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-var">RWST</span></a></span><span> </span><span class="annot"><span class="annottext">((r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a)
-&gt; (r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span class="annot"><span class="annottext">r
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679077709"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077709"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679077708"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077708"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-259"></span><span>        </span><span id="local-6989586621679077707"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679077707"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">m a
</span><a href="#local-6989586621679077710"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-260"></span><span>        </span><span class="annot"><span class="annottext">(a, s, w) -&gt; m (a, s, w)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679077707"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077709"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077708"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-261"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.Class.html#lift"><span class="hs-pragma hs-type">lift</span></a></span><span> </span><span class="hs-pragma">#-}</span></span></span></span><span>
</span><span id="line-262"></span><span>
</span><span id="line-263"></span><span id="local-6989586621679078176"><span id="local-6989586621679078177"><span id="local-6989586621679078178"><span id="local-6989586621679078179"><span class="hs-keyword">instance</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Control.Monad.IO.Class.html#MonadIO"><span class="hs-identifier hs-type">MonadIO</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078179"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.IO.Class.html#MonadIO"><span class="hs-identifier hs-type">MonadIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078178"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078177"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078176"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078179"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-264"></span><span>    </span><span id="local-6989586621679077695"><span class="annot"><span class="annottext">liftIO :: forall a. IO a -&gt; RWST r w s m a
</span><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier hs-var hs-var hs-var hs-var">liftIO</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">m a -&gt; RWST r w s m a
forall (t :: (* -&gt; *) -&gt; * -&gt; *) (m :: * -&gt; *) a.
(MonadTrans t, Monad m) =&gt;
m a -&gt; t m a
</span><a href="Control.Monad.Trans.Class.html#lift"><span class="hs-identifier hs-var">lift</span></a></span><span> </span><span class="annot"><span class="annottext">(m a -&gt; RWST r w s m a) -&gt; (IO a -&gt; m a) -&gt; IO a -&gt; RWST r w s m a
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">IO a -&gt; m a
forall (m :: * -&gt; *) a. MonadIO m =&gt; IO a -&gt; m a
</span><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span>
</span><span id="line-265"></span><span>    </span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-pragma hs-type">liftIO</span></a></span><span> </span><span class="hs-pragma">#-}</span></span></span></span></span><span>
</span><span id="line-266"></span><span class="hs-comment">-- ---------------------------------------------------------------------------</span><span>
</span><span id="line-267"></span><span class="hs-comment">-- Reader operations</span><span>
</span><span id="line-268"></span><span>
</span><span id="line-269"></span><span class="hs-comment">-- | Constructor for computations in the reader monad (equivalent to 'asks').</span><span>
</span><span id="line-270"></span><span id="local-6989586621679078170"><span id="local-6989586621679078171"><span id="local-6989586621679078172"><span id="local-6989586621679078173"><span id="local-6989586621679078174"><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#reader"><span class="hs-identifier hs-type">reader</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078174"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679078173"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679078172"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078173"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078171"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078170"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078174"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078172"><span class="hs-identifier hs-type">a</span></a></span></span></span></span></span></span><span>
</span><span id="line-271"></span><span id="reader"><span class="annot"><span class="annottext">reader :: forall (m :: * -&gt; *) r a w s. Monad m =&gt; (r -&gt; a) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#reader"><span class="hs-identifier hs-var hs-var">reader</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(r -&gt; a) -&gt; RWST r w s m a
forall (m :: * -&gt; *) r a w s. Monad m =&gt; (r -&gt; a) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#asks"><span class="hs-identifier hs-var">asks</span></a></span><span>
</span><span id="line-272"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#reader"><span class="hs-pragma hs-type">reader</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-273"></span><span>
</span><span id="line-274"></span><span class="hs-comment">-- | Fetch the value of the environment.</span><span>
</span><span id="line-275"></span><span id="local-6989586621679078161"><span id="local-6989586621679078162"><span id="local-6989586621679078163"><span id="local-6989586621679078164"><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#ask"><span class="hs-identifier hs-type">ask</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078164"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078163"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078162"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078161"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078164"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078163"><span class="hs-identifier hs-type">r</span></a></span></span></span></span></span><span>
</span><span id="line-276"></span><span id="ask"><span class="annot"><span class="annottext">ask :: forall (m :: * -&gt; *) r w s. Monad m =&gt; RWST r w s m r
</span><a href="Control.Monad.Trans.RWS.CPS.html#ask"><span class="hs-identifier hs-var hs-var">ask</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(r -&gt; r) -&gt; RWST r w s m r
forall (m :: * -&gt; *) r a w s. Monad m =&gt; (r -&gt; a) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#asks"><span class="hs-identifier hs-var">asks</span></a></span><span> </span><span class="annot"><span class="annottext">r -&gt; r
forall a. a -&gt; a
</span><a href="../../base/src/GHC.Base.html#id"><span class="hs-identifier hs-var">id</span></a></span><span>
</span><span id="line-277"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#ask"><span class="hs-pragma hs-type">ask</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-278"></span><span>
</span><span id="line-279"></span><span class="hs-comment">-- | Execute a computation in a modified environment</span><span>
</span><span id="line-280"></span><span class="hs-comment">--</span><span>
</span><span id="line-281"></span><span class="hs-comment">-- * @'runRWST' ('local' f m) r s = 'runRWST' m (f r) s@</span><span>
</span><span id="line-282"></span><span id="local-6989586621679078151"><span id="local-6989586621679078152"><span id="local-6989586621679078153"><span id="local-6989586621679078154"><span id="local-6989586621679078155"><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#local"><span class="hs-identifier hs-type">local</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679078155"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679078155"><span class="hs-identifier hs-type">r</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078155"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078154"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078153"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078152"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078151"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078155"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078154"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078153"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078152"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078151"><span class="hs-identifier hs-type">a</span></a></span></span></span></span></span></span><span>
</span><span id="line-283"></span><span id="local"><span class="annot"><span class="annottext">local :: forall r w s (m :: * -&gt; *) a.
(r -&gt; r) -&gt; RWST r w s m a -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#local"><span class="hs-identifier hs-var hs-var">local</span></a></span></span><span> </span><span id="local-6989586621679077688"><span class="annot"><span class="annottext">r -&gt; r
</span><a href="#local-6989586621679077688"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679077687"><span class="annot"><span class="annottext">RWST r w s m a
</span><a href="#local-6989586621679077687"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
forall r w s (m :: * -&gt; *) a.
(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-var">RWST</span></a></span><span> </span><span class="annot"><span class="annottext">((r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a)
-&gt; (r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679077686"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077686"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span id="local-6989586621679077685"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077685"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679077684"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077684"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">RWST r w s m a -&gt; r -&gt; s -&gt; w -&gt; m (a, s, w)
forall r w s (m :: * -&gt; *) a.
RWST r w s m a -&gt; r -&gt; s -&gt; w -&gt; m (a, s, w)
</span><a href="Control.Monad.Trans.RWS.CPS.html#unRWST"><span class="hs-identifier hs-var hs-var">unRWST</span></a></span><span> </span><span class="annot"><span class="annottext">RWST r w s m a
</span><a href="#local-6989586621679077687"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">r -&gt; r
</span><a href="#local-6989586621679077688"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077686"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077685"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077684"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-284"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#local"><span class="hs-pragma hs-type">local</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-285"></span><span>
</span><span id="line-286"></span><span class="hs-comment">-- | Retrieve a function of the current environment.</span><span>
</span><span id="line-287"></span><span class="hs-comment">--</span><span>
</span><span id="line-288"></span><span class="hs-comment">-- * @'asks' f = 'liftM' f 'ask'@</span><span>
</span><span id="line-289"></span><span id="local-6989586621679077679"><span id="local-6989586621679077680"><span id="local-6989586621679077681"><span id="local-6989586621679077682"><span id="local-6989586621679077683"><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#asks"><span class="hs-identifier hs-type">asks</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679077683"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679077682"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679077681"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679077682"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679077680"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679077679"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679077683"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679077681"><span class="hs-identifier hs-type">a</span></a></span></span></span></span></span></span><span>
</span><span id="line-290"></span><span id="asks"><span class="annot"><span class="annottext">asks :: forall (m :: * -&gt; *) r a w s. Monad m =&gt; (r -&gt; a) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#asks"><span class="hs-identifier hs-var hs-var">asks</span></a></span></span><span> </span><span id="local-6989586621679077676"><span class="annot"><span class="annottext">r -&gt; a
</span><a href="#local-6989586621679077676"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
forall r w s (m :: * -&gt; *) a.
(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-var">RWST</span></a></span><span> </span><span class="annot"><span class="annottext">((r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a)
-&gt; (r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679077675"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077675"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span id="local-6989586621679077674"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077674"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679077673"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077673"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(a, s, w) -&gt; m (a, s, w)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">r -&gt; a
</span><a href="#local-6989586621679077676"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077675"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077674"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077673"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-291"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#asks"><span class="hs-pragma hs-type">asks</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-292"></span><span>
</span><span id="line-293"></span><span class="hs-comment">-- ---------------------------------------------------------------------------</span><span>
</span><span id="line-294"></span><span class="hs-comment">-- Writer operations</span><span>
</span><span id="line-295"></span><span>
</span><span id="line-296"></span><span class="hs-comment">-- | Construct a writer computation from a (result, output) pair.</span><span>
</span><span id="line-297"></span><span id="local-6989586621679078136"><span id="local-6989586621679078137"><span id="local-6989586621679078138"><span id="local-6989586621679078139"><span id="local-6989586621679078140"><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#writer"><span class="hs-identifier hs-type">writer</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078140"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078139"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679078138"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679078140"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078137"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078140"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078136"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078139"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078138"><span class="hs-identifier hs-type">a</span></a></span></span></span></span></span></span><span>
</span><span id="line-298"></span><span id="writer"><span class="annot"><span class="annottext">writer :: forall w (m :: * -&gt; *) a r s.
(Monoid w, Monad m) =&gt;
(a, w) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#writer"><span class="hs-identifier hs-var hs-var">writer</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621679077669"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679077669"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679077668"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077668"><span class="hs-identifier hs-var">w'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
forall r w s (m :: * -&gt; *) a.
(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-var">RWST</span></a></span><span> </span><span class="annot"><span class="annottext">((r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a)
-&gt; (r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span class="annot"><span class="annottext">r
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679077667"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077667"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679077666"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077666"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679077664"><span class="annot"><span class="annottext">wt :: w
</span><a href="#local-6989586621679077664"><span class="hs-identifier hs-var hs-var">wt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077666"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">w -&gt; w -&gt; w
forall a. Monoid a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#mappend"><span class="hs-operator hs-var">`mappend`</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077668"><span class="hs-identifier hs-var">w'</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077664"><span class="hs-identifier hs-var">wt</span></a></span><span> </span><span class="annot"><span class="annottext">w -&gt; m (a, s, w) -&gt; m (a, s, w)
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">(a, s, w) -&gt; m (a, s, w)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679077669"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077667"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077664"><span class="hs-identifier hs-var">wt</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-299"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#writer"><span class="hs-pragma hs-type">writer</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-300"></span><span>
</span><span id="line-301"></span><span class="hs-comment">-- | @'tell' w@ is an action that produces the output @w@.</span><span>
</span><span id="line-302"></span><span id="local-6989586621679078127"><span id="local-6989586621679078128"><span id="local-6989586621679078129"><span id="local-6989586621679078130"><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#tell"><span class="hs-identifier hs-type">tell</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078130"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078129"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679078130"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078128"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078130"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078127"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078129"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span></span></span></span></span><span>
</span><span id="line-303"></span><span id="tell"><span class="annot"><span class="annottext">tell :: forall w (m :: * -&gt; *) r s.
(Monoid w, Monad m) =&gt;
w -&gt; RWST r w s m ()
</span><a href="Control.Monad.Trans.RWS.CPS.html#tell"><span class="hs-identifier hs-var hs-var">tell</span></a></span></span><span> </span><span id="local-6989586621679077659"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077659"><span class="hs-identifier hs-var">w'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((), w) -&gt; RWST r w s m ()
forall w (m :: * -&gt; *) a r s.
(Monoid w, Monad m) =&gt;
(a, w) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#writer"><span class="hs-identifier hs-var">writer</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077659"><span class="hs-identifier hs-var">w'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-304"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#tell"><span class="hs-pragma hs-type">tell</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-305"></span><span>
</span><span id="line-306"></span><span class="hs-comment">-- | @'listen' m@ is an action that executes the action @m@ and adds its</span><span>
</span><span id="line-307"></span><span class="hs-comment">-- output to the value of the computation.</span><span>
</span><span id="line-308"></span><span class="hs-comment">--</span><span>
</span><span id="line-309"></span><span class="hs-comment">-- * @'runRWST' ('listen' m) r s = 'liftM' (\\ (a, w) -&gt; ((a, w), w)) ('runRWST' m r s)@</span><span>
</span><span id="line-310"></span><span id="local-6989586621679078118"><span id="local-6989586621679078119"><span id="local-6989586621679078120"><span id="local-6989586621679078121"><span id="local-6989586621679078122"><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#listen"><span class="hs-identifier hs-type">listen</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078122"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078121"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078120"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078122"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078119"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078121"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078118"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078120"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078122"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078119"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078121"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679078118"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679078122"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span></span></span></span></span></span><span>
</span><span id="line-311"></span><span id="listen"><span class="annot"><span class="annottext">listen :: forall w (m :: * -&gt; *) r s a.
(Monoid w, Monad m) =&gt;
RWST r w s m a -&gt; RWST r w s m (a, w)
</span><a href="Control.Monad.Trans.RWS.CPS.html#listen"><span class="hs-identifier hs-var hs-var">listen</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(w -&gt; w) -&gt; RWST r w s m a -&gt; RWST r w s m (a, w)
forall w (m :: * -&gt; *) b r s a.
(Monoid w, Monad m) =&gt;
(w -&gt; b) -&gt; RWST r w s m a -&gt; RWST r w s m (a, b)
</span><a href="Control.Monad.Trans.RWS.CPS.html#listens"><span class="hs-identifier hs-var">listens</span></a></span><span> </span><span class="annot"><span class="annottext">w -&gt; w
forall a. a -&gt; a
</span><a href="../../base/src/GHC.Base.html#id"><span class="hs-identifier hs-var">id</span></a></span><span>
</span><span id="line-312"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#listen"><span class="hs-pragma hs-type">listen</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-313"></span><span>
</span><span id="line-314"></span><span class="hs-comment">-- | @'listens' f m@ is an action that executes the action @m@ and adds</span><span>
</span><span id="line-315"></span><span class="hs-comment">-- the result of applying @f@ to the output to the value of the computation.</span><span>
</span><span id="line-316"></span><span class="hs-comment">--</span><span>
</span><span id="line-317"></span><span class="hs-comment">-- * @'listens' f m = 'liftM' (id *** f) ('listen' m)@</span><span>
</span><span id="line-318"></span><span class="hs-comment">--</span><span>
</span><span id="line-319"></span><span class="hs-comment">-- * @'runRWST' ('listens' f m) r s = 'liftM' (\\ (a, w) -&gt; ((a, f w), w)) ('runRWST' m r s)@</span><span>
</span><span id="line-320"></span><span id="local-6989586621679078107"><span id="local-6989586621679078108"><span id="local-6989586621679078109"><span id="local-6989586621679078110"><span id="local-6989586621679078111"><span id="local-6989586621679078112"><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#listens"><span class="hs-identifier hs-type">listens</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078112"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078111"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679078112"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679078110"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078109"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078112"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078108"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078111"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078107"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078109"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078112"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078108"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078111"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679078107"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679078110"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span></span></span></span></span></span></span><span>
</span><span id="line-321"></span><span id="listens"><span class="annot"><span class="annottext">listens :: forall w (m :: * -&gt; *) b r s a.
(Monoid w, Monad m) =&gt;
(w -&gt; b) -&gt; RWST r w s m a -&gt; RWST r w s m (a, b)
</span><a href="Control.Monad.Trans.RWS.CPS.html#listens"><span class="hs-identifier hs-var hs-var">listens</span></a></span></span><span> </span><span id="local-6989586621679077649"><span class="annot"><span class="annottext">w -&gt; b
</span><a href="#local-6989586621679077649"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679077648"><span class="annot"><span class="annottext">RWST r w s m a
</span><a href="#local-6989586621679077648"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(r -&gt; s -&gt; w -&gt; m ((a, b), s, w)) -&gt; RWST r w s m (a, b)
forall r w s (m :: * -&gt; *) a.
(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-var">RWST</span></a></span><span> </span><span class="annot"><span class="annottext">((r -&gt; s -&gt; w -&gt; m ((a, b), s, w)) -&gt; RWST r w s m (a, b))
-&gt; (r -&gt; s -&gt; w -&gt; m ((a, b), s, w)) -&gt; RWST r w s m (a, b)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679077647"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077647"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span id="local-6989586621679077646"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077646"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679077645"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077645"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-322"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621679077644"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679077644"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679077643"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077643"><span class="hs-identifier hs-var">s'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679077642"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077642"><span class="hs-identifier hs-var">w'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RWST r w s m a -&gt; r -&gt; s -&gt; m (a, s, w)
forall w r s (m :: * -&gt; *) a.
Monoid w =&gt;
RWST r w s m a -&gt; r -&gt; s -&gt; m (a, s, w)
</span><a href="Control.Monad.Trans.RWS.CPS.html#runRWST"><span class="hs-identifier hs-var">runRWST</span></a></span><span> </span><span class="annot"><span class="annottext">RWST r w s m a
</span><a href="#local-6989586621679077648"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077647"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077646"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-323"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679077640"><span class="annot"><span class="annottext">wt :: w
</span><a href="#local-6989586621679077640"><span class="hs-identifier hs-var hs-var">wt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077645"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">w -&gt; w -&gt; w
forall a. Monoid a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#mappend"><span class="hs-operator hs-var">`mappend`</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077642"><span class="hs-identifier hs-var">w'</span></a></span><span>
</span><span id="line-324"></span><span>    </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077640"><span class="hs-identifier hs-var">wt</span></a></span><span> </span><span class="annot"><span class="annottext">w -&gt; m ((a, b), s, w) -&gt; m ((a, b), s, w)
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">((a, b), s, w) -&gt; m ((a, b), s, w)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679077644"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w -&gt; b
</span><a href="#local-6989586621679077649"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077642"><span class="hs-identifier hs-var">w'</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077643"><span class="hs-identifier hs-var">s'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077640"><span class="hs-identifier hs-var">wt</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-325"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#listens"><span class="hs-pragma hs-type">listens</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-326"></span><span>
</span><span id="line-327"></span><span class="hs-comment">-- | @'pass' m@ is an action that executes the action @m@, which returns</span><span>
</span><span id="line-328"></span><span class="hs-comment">-- a value and a function, and returns the value, applying the function</span><span>
</span><span id="line-329"></span><span class="hs-comment">-- to the output.</span><span>
</span><span id="line-330"></span><span class="hs-comment">--</span><span>
</span><span id="line-331"></span><span class="hs-comment">-- * @'runRWST' ('pass' m) r s = 'liftM' (\\ ((a, f), w) -&gt; (a, f w)) ('runRWST' m r s)@</span><span>
</span><span id="line-332"></span><span id="local-6989586621679078095"><span id="local-6989586621679078096"><span id="local-6989586621679078097"><span id="local-6989586621679078098"><span id="local-6989586621679078099"><span id="local-6989586621679078100"><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#pass"><span class="hs-identifier hs-type">pass</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078100"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078099"><span class="hs-identifier hs-type">w'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078098"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078097"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078100"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078096"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078098"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679078095"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679078100"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679078099"><span class="hs-identifier hs-type">w'</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078097"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078099"><span class="hs-identifier hs-type">w'</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078096"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078098"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078095"><span class="hs-identifier hs-type">a</span></a></span></span></span></span></span></span></span><span>
</span><span id="line-333"></span><span id="pass"><span class="annot"><span class="annottext">pass :: forall w w' (m :: * -&gt; *) r s a.
(Monoid w, Monoid w', Monad m) =&gt;
RWST r w s m (a, w -&gt; w') -&gt; RWST r w' s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#pass"><span class="hs-identifier hs-var hs-var">pass</span></a></span></span><span> </span><span id="local-6989586621679077633"><span class="annot"><span class="annottext">RWST r w s m (a, w -&gt; w')
</span><a href="#local-6989586621679077633"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(r -&gt; s -&gt; w' -&gt; m (a, s, w')) -&gt; RWST r w' s m a
forall r w s (m :: * -&gt; *) a.
(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-var">RWST</span></a></span><span> </span><span class="annot"><span class="annottext">((r -&gt; s -&gt; w' -&gt; m (a, s, w')) -&gt; RWST r w' s m a)
-&gt; (r -&gt; s -&gt; w' -&gt; m (a, s, w')) -&gt; RWST r w' s m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679077632"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077632"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span id="local-6989586621679077631"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077631"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679077630"><span class="annot"><span class="annottext">w'
</span><a href="#local-6989586621679077630"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-334"></span><span>    </span><span class="hs-special">(</span><span class="hs-special">(</span><span id="local-6989586621679077629"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679077629"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679077628"><span class="annot"><span class="annottext">w -&gt; w'
</span><a href="#local-6989586621679077628"><span class="hs-identifier hs-var">f</span></a></span></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span id="local-6989586621679077627"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077627"><span class="hs-identifier hs-var">s'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679077626"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077626"><span class="hs-identifier hs-var">w'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RWST r w s m (a, w -&gt; w') -&gt; r -&gt; s -&gt; m ((a, w -&gt; w'), s, w)
forall w r s (m :: * -&gt; *) a.
Monoid w =&gt;
RWST r w s m a -&gt; r -&gt; s -&gt; m (a, s, w)
</span><a href="Control.Monad.Trans.RWS.CPS.html#runRWST"><span class="hs-identifier hs-var">runRWST</span></a></span><span> </span><span class="annot"><span class="annottext">RWST r w s m (a, w -&gt; w')
</span><a href="#local-6989586621679077633"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077632"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077631"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-335"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679077624"><span class="annot"><span class="annottext">wt :: w'
</span><a href="#local-6989586621679077624"><span class="hs-identifier hs-var hs-var">wt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">w'
</span><a href="#local-6989586621679077630"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">w' -&gt; w' -&gt; w'
forall a. Monoid a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#mappend"><span class="hs-operator hs-var">`mappend`</span></a></span><span> </span><span class="annot"><span class="annottext">w -&gt; w'
</span><a href="#local-6989586621679077628"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077626"><span class="hs-identifier hs-var">w'</span></a></span><span>
</span><span id="line-336"></span><span>    </span><span class="annot"><span class="annottext">w'
</span><a href="#local-6989586621679077624"><span class="hs-identifier hs-var">wt</span></a></span><span> </span><span class="annot"><span class="annottext">w' -&gt; m (a, s, w') -&gt; m (a, s, w')
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">(a, s, w') -&gt; m (a, s, w')
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679077629"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077627"><span class="hs-identifier hs-var">s'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w'
</span><a href="#local-6989586621679077624"><span class="hs-identifier hs-var">wt</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-337"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#pass"><span class="hs-pragma hs-type">pass</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-338"></span><span>
</span><span id="line-339"></span><span class="hs-comment">-- | @'censor' f m@ is an action that executes the action @m@ and</span><span>
</span><span id="line-340"></span><span class="hs-comment">-- applies the function @f@ to its output, leaving the return value</span><span>
</span><span id="line-341"></span><span class="hs-comment">-- unchanged.</span><span>
</span><span id="line-342"></span><span class="hs-comment">--</span><span>
</span><span id="line-343"></span><span class="hs-comment">-- * @'censor' f m = 'pass' ('liftM' (\\ x -&gt; (x,f)) m)@</span><span>
</span><span id="line-344"></span><span class="hs-comment">--</span><span>
</span><span id="line-345"></span><span class="hs-comment">-- * @'runRWST' ('censor' f m) r s = 'liftM' (\\ (a, w) -&gt; (a, f w)) ('runRWST' m r s)@</span><span>
</span><span id="line-346"></span><span id="local-6989586621679078084"><span id="local-6989586621679078085"><span id="local-6989586621679078086"><span id="local-6989586621679078087"><span id="local-6989586621679078088"><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#censor"><span class="hs-identifier hs-type">censor</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monoid"><span class="hs-identifier hs-type">Monoid</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078088"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078087"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679078088"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679078088"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078086"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078088"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078085"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078087"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078084"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078086"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078088"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078085"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078087"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078084"><span class="hs-identifier hs-type">a</span></a></span></span></span></span></span></span><span>
</span><span id="line-347"></span><span id="censor"><span class="annot"><span class="annottext">censor :: forall w (m :: * -&gt; *) r s a.
(Monoid w, Monad m) =&gt;
(w -&gt; w) -&gt; RWST r w s m a -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#censor"><span class="hs-identifier hs-var hs-var">censor</span></a></span></span><span> </span><span id="local-6989586621679077618"><span class="annot"><span class="annottext">w -&gt; w
</span><a href="#local-6989586621679077618"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span id="local-6989586621679077617"><span class="annot"><span class="annottext">RWST r w s m a
</span><a href="#local-6989586621679077617"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
forall r w s (m :: * -&gt; *) a.
(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-var">RWST</span></a></span><span> </span><span class="annot"><span class="annottext">((r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a)
-&gt; (r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679077616"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077616"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span id="local-6989586621679077615"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077615"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679077614"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077614"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-348"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621679077613"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679077613"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679077612"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077612"><span class="hs-identifier hs-var">s'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679077611"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077611"><span class="hs-identifier hs-var">w'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RWST r w s m a -&gt; r -&gt; s -&gt; m (a, s, w)
forall w r s (m :: * -&gt; *) a.
Monoid w =&gt;
RWST r w s m a -&gt; r -&gt; s -&gt; m (a, s, w)
</span><a href="Control.Monad.Trans.RWS.CPS.html#runRWST"><span class="hs-identifier hs-var">runRWST</span></a></span><span> </span><span class="annot"><span class="annottext">RWST r w s m a
</span><a href="#local-6989586621679077617"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077616"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077615"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-349"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621679077609"><span class="annot"><span class="annottext">wt :: w
</span><a href="#local-6989586621679077609"><span class="hs-identifier hs-var hs-var">wt</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077614"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">w -&gt; w -&gt; w
forall a. Monoid a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Base.html#mappend"><span class="hs-operator hs-var">`mappend`</span></a></span><span> </span><span class="annot"><span class="annottext">w -&gt; w
</span><a href="#local-6989586621679077618"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077611"><span class="hs-identifier hs-var">w'</span></a></span><span>
</span><span id="line-350"></span><span>    </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077609"><span class="hs-identifier hs-var">wt</span></a></span><span> </span><span class="annot"><span class="annottext">w -&gt; m (a, s, w) -&gt; m (a, s, w)
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">(a, s, w) -&gt; m (a, s, w)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679077613"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077612"><span class="hs-identifier hs-var">s'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077609"><span class="hs-identifier hs-var">wt</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-351"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#censor"><span class="hs-pragma hs-type">censor</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-352"></span><span>
</span><span id="line-353"></span><span class="hs-comment">-- ---------------------------------------------------------------------------</span><span>
</span><span id="line-354"></span><span class="hs-comment">-- State operations</span><span>
</span><span id="line-355"></span><span>
</span><span id="line-356"></span><span class="hs-comment">-- | Construct a state monad computation from a state transformer function.</span><span>
</span><span id="line-357"></span><span id="local-6989586621679078074"><span id="local-6989586621679078075"><span id="local-6989586621679078076"><span id="local-6989586621679078077"><span id="local-6989586621679078078"><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#state"><span class="hs-identifier hs-type">state</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078078"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679078077"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679078076"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621679078077"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078075"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078074"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078077"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078078"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078076"><span class="hs-identifier hs-type">a</span></a></span></span></span></span></span></span><span>
</span><span id="line-358"></span><span id="state"><span class="annot"><span class="annottext">state :: forall (m :: * -&gt; *) s a r w.
Monad m =&gt;
(s -&gt; (a, s)) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#state"><span class="hs-identifier hs-var hs-var">state</span></a></span></span><span> </span><span id="local-6989586621679077606"><span class="annot"><span class="annottext">s -&gt; (a, s)
</span><a href="#local-6989586621679077606"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
forall r w s (m :: * -&gt; *) a.
(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-var">RWST</span></a></span><span> </span><span class="annot"><span class="annottext">((r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a)
-&gt; (r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span class="annot"><span class="annottext">r
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679077605"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077605"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679077604"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077604"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621679077603"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679077603"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621679077602"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077602"><span class="hs-identifier hs-var">s'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">s -&gt; (a, s)
</span><a href="#local-6989586621679077606"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077605"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-keyword">in</span><span> </span><span class="annot"><span class="annottext">(a, s, w) -&gt; m (a, s, w)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679077603"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077602"><span class="hs-identifier hs-var">s'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077604"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-359"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#state"><span class="hs-pragma hs-type">state</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-360"></span><span>
</span><span id="line-361"></span><span class="hs-comment">-- | Fetch the current value of the state within the monad.</span><span>
</span><span id="line-362"></span><span id="local-6989586621679078065"><span id="local-6989586621679078066"><span id="local-6989586621679078067"><span id="local-6989586621679078068"><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#get"><span class="hs-identifier hs-type">get</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078068"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078067"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078066"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078065"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078068"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078065"><span class="hs-identifier hs-type">s</span></a></span></span></span></span></span><span>
</span><span id="line-363"></span><span id="get"><span class="annot"><span class="annottext">get :: forall (m :: * -&gt; *) r w s. Monad m =&gt; RWST r w s m s
</span><a href="Control.Monad.Trans.RWS.CPS.html#get"><span class="hs-identifier hs-var hs-var">get</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(s -&gt; s) -&gt; RWST r w s m s
forall (m :: * -&gt; *) s a r w. Monad m =&gt; (s -&gt; a) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#gets"><span class="hs-identifier hs-var">gets</span></a></span><span> </span><span class="annot"><span class="annottext">s -&gt; s
forall a. a -&gt; a
</span><a href="../../base/src/GHC.Base.html#id"><span class="hs-identifier hs-var">id</span></a></span><span>
</span><span id="line-364"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#get"><span class="hs-pragma hs-type">get</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-365"></span><span>
</span><span id="line-366"></span><span class="hs-comment">-- | @'put' s@ sets the state within the monad to @s@.</span><span>
</span><span id="line-367"></span><span id="local-6989586621679078052"><span id="local-6989586621679078053"><span id="local-6989586621679078054"><span id="local-6989586621679078055"><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#put"><span class="hs-identifier hs-type">put</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078055"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span class="annot"><a href="#local-6989586621679078054"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078053"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078052"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078054"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078055"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span></span></span></span></span><span>
</span><span id="line-368"></span><span id="put"><span class="annot"><span class="annottext">put :: forall (m :: * -&gt; *) s r w. Monad m =&gt; s -&gt; RWST r w s m ()
</span><a href="Control.Monad.Trans.RWS.CPS.html#put"><span class="hs-identifier hs-var hs-var">put</span></a></span></span><span> </span><span id="local-6989586621679077597"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077597"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(r -&gt; s -&gt; w -&gt; m ((), s, w)) -&gt; RWST r w s m ()
forall r w s (m :: * -&gt; *) a.
(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-var">RWST</span></a></span><span> </span><span class="annot"><span class="annottext">((r -&gt; s -&gt; w -&gt; m ((), s, w)) -&gt; RWST r w s m ())
-&gt; (r -&gt; s -&gt; w -&gt; m ((), s, w)) -&gt; RWST r w s m ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span class="annot"><span class="annottext">r
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">s
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679077596"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077596"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">((), s, w) -&gt; m ((), s, w)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077597"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077596"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-369"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#put"><span class="hs-pragma hs-type">put</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-370"></span><span>
</span><span id="line-371"></span><span class="hs-comment">-- | @'modify' f@ is an action that updates the state to the result of</span><span>
</span><span id="line-372"></span><span class="hs-comment">-- applying @f@ to the current state.</span><span>
</span><span id="line-373"></span><span class="hs-comment">--</span><span>
</span><span id="line-374"></span><span class="hs-comment">-- * @'modify' f = 'get' &gt;&gt;= ('put' . f)@</span><span>
</span><span id="line-375"></span><span id="local-6989586621679078044"><span id="local-6989586621679078045"><span id="local-6989586621679078046"><span id="local-6989586621679078047"><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#modify"><span class="hs-identifier hs-type">modify</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078047"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679078046"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679078046"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078045"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078044"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078046"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078047"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span></span></span></span></span><span>
</span><span id="line-376"></span><span id="modify"><span class="annot"><span class="annottext">modify :: forall (m :: * -&gt; *) s r w. Monad m =&gt; (s -&gt; s) -&gt; RWST r w s m ()
</span><a href="Control.Monad.Trans.RWS.CPS.html#modify"><span class="hs-identifier hs-var hs-var">modify</span></a></span></span><span> </span><span id="local-6989586621679077593"><span class="annot"><span class="annottext">s -&gt; s
</span><a href="#local-6989586621679077593"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(r -&gt; s -&gt; w -&gt; m ((), s, w)) -&gt; RWST r w s m ()
forall r w s (m :: * -&gt; *) a.
(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-var">RWST</span></a></span><span> </span><span class="annot"><span class="annottext">((r -&gt; s -&gt; w -&gt; m ((), s, w)) -&gt; RWST r w s m ())
-&gt; (r -&gt; s -&gt; w -&gt; m ((), s, w)) -&gt; RWST r w s m ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span class="annot"><span class="annottext">r
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679077592"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077592"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679077591"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077591"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">((), s, w) -&gt; m ((), s, w)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">s -&gt; s
</span><a href="#local-6989586621679077593"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077592"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077591"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-377"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#modify"><span class="hs-pragma hs-type">modify</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-378"></span><span>
</span><span id="line-379"></span><span class="hs-comment">-- | Get a specific component of the state, using a projection function</span><span>
</span><span id="line-380"></span><span class="hs-comment">-- supplied.</span><span>
</span><span id="line-381"></span><span class="hs-comment">--</span><span>
</span><span id="line-382"></span><span class="hs-comment">-- * @'gets' f = 'liftM' f 'get'@</span><span>
</span><span id="line-383"></span><span id="local-6989586621679078056"><span id="local-6989586621679078057"><span id="local-6989586621679078058"><span id="local-6989586621679078059"><span id="local-6989586621679078060"><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#gets"><span class="hs-identifier hs-type">gets</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Base.html#Monad"><span class="hs-identifier hs-type">Monad</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078060"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679078059"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621679078058"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078057"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078056"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078059"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078060"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078058"><span class="hs-identifier hs-type">a</span></a></span></span></span></span></span></span><span>
</span><span id="line-384"></span><span id="gets"><span class="annot"><span class="annottext">gets :: forall (m :: * -&gt; *) s a r w. Monad m =&gt; (s -&gt; a) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#gets"><span class="hs-identifier hs-var hs-var">gets</span></a></span></span><span> </span><span id="local-6989586621679077588"><span class="annot"><span class="annottext">s -&gt; a
</span><a href="#local-6989586621679077588"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
forall r w s (m :: * -&gt; *) a.
(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-var">RWST</span></a></span><span> </span><span class="annot"><span class="annottext">((r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a)
-&gt; (r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span class="annot"><span class="annottext">r
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679077587"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077587"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679077586"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077586"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(a, s, w) -&gt; m (a, s, w)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">s -&gt; a
</span><a href="#local-6989586621679077588"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077587"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077587"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077586"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-385"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#gets"><span class="hs-pragma hs-type">gets</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-386"></span><span>
</span><span id="line-387"></span><span class="hs-comment">-- | Uniform lifting of a @callCC@ operation to the new monad.</span><span>
</span><span id="line-388"></span><span class="hs-comment">-- This version rolls back to the original state on entering the</span><span>
</span><span id="line-389"></span><span class="hs-comment">-- continuation.</span><span>
</span><span id="line-390"></span><span id="local-6989586621679078028"><span id="local-6989586621679078030"><span id="local-6989586621679078031"><span id="local-6989586621679078032"><span id="local-6989586621679078033"><span id="local-6989586621679078034"><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#liftCallCC"><span class="hs-identifier hs-type">liftCallCC</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Control.Monad.Signatures.html#CallCC"><span class="hs-identifier hs-type">CallCC</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078034"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679078033"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679078032"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679078031"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679078030"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679078032"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679078031"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Signatures.html#CallCC"><span class="hs-identifier hs-type">CallCC</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078028"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078031"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078032"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078034"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><a href="#local-6989586621679078033"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078030"><span class="hs-identifier hs-type">b</span></a></span></span></span></span></span></span></span><span>
</span><span id="line-391"></span><span id="liftCallCC"><span class="annot"><span class="annottext">liftCallCC :: forall (m :: * -&gt; *) a s w b r.
CallCC m (a, s, w) (b, s, w) -&gt; CallCC (RWST r w s m) a b
</span><a href="Control.Monad.Trans.RWS.CPS.html#liftCallCC"><span class="hs-identifier hs-var hs-var">liftCallCC</span></a></span></span><span> </span><span id="local-6989586621679077585"><span class="annot"><span class="annottext">CallCC m (a, s, w) (b, s, w)
</span><a href="#local-6989586621679077585"><span class="hs-identifier hs-var">callCC</span></a></span></span><span> </span><span id="local-6989586621679077584"><span class="annot"><span class="annottext">(a -&gt; RWST r w s m b) -&gt; RWST r w s m a
</span><a href="#local-6989586621679077584"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
forall r w s (m :: * -&gt; *) a.
(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-var">RWST</span></a></span><span> </span><span class="annot"><span class="annottext">((r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a)
-&gt; (r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679077583"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077583"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span id="local-6989586621679077582"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077582"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679077581"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077581"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-392"></span><span>    </span><span class="annot"><span class="annottext">CallCC m (a, s, w) (b, s, w)
</span><a href="#local-6989586621679077585"><span class="hs-identifier hs-var">callCC</span></a></span><span> </span><span class="annot"><span class="annottext">CallCC m (a, s, w) (b, s, w) -&gt; CallCC m (a, s, w) (b, s, w)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679077580"><span class="annot"><span class="annottext">(a, s, w) -&gt; m (b, s, w)
</span><a href="#local-6989586621679077580"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">RWST r w s m a -&gt; r -&gt; s -&gt; w -&gt; m (a, s, w)
forall r w s (m :: * -&gt; *) a.
RWST r w s m a -&gt; r -&gt; s -&gt; w -&gt; m (a, s, w)
</span><a href="Control.Monad.Trans.RWS.CPS.html#unRWST"><span class="hs-identifier hs-var hs-var">unRWST</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; RWST r w s m b) -&gt; RWST r w s m a
</span><a href="#local-6989586621679077584"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679077579"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679077579"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(r -&gt; s -&gt; w -&gt; m (b, s, w)) -&gt; RWST r w s m b
forall r w s (m :: * -&gt; *) a.
(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-var">RWST</span></a></span><span> </span><span class="annot"><span class="annottext">((r -&gt; s -&gt; w -&gt; m (b, s, w)) -&gt; RWST r w s m b)
-&gt; (r -&gt; s -&gt; w -&gt; m (b, s, w)) -&gt; RWST r w s m b
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span class="annot"><span class="annottext">r
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">s
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">w
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(a, s, w) -&gt; m (b, s, w)
</span><a href="#local-6989586621679077580"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679077579"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077582"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077581"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077583"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077582"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077581"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-393"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#liftCallCC"><span class="hs-pragma hs-type">liftCallCC</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-394"></span><span>
</span><span id="line-395"></span><span class="hs-comment">-- | In-situ lifting of a @callCC@ operation to the new monad.</span><span>
</span><span id="line-396"></span><span class="hs-comment">-- This version uses the current state on entering the continuation.</span><span>
</span><span id="line-397"></span><span id="local-6989586621679077573"><span id="local-6989586621679077574"><span id="local-6989586621679077575"><span id="local-6989586621679077576"><span id="local-6989586621679077577"><span id="local-6989586621679077578"><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#liftCallCC%27"><span class="hs-identifier hs-type">liftCallCC'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Control.Monad.Signatures.html#CallCC"><span class="hs-identifier hs-type">CallCC</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679077578"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679077577"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679077576"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679077575"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679077574"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679077576"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679077575"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Signatures.html#CallCC"><span class="hs-identifier hs-type">CallCC</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679077573"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679077575"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679077576"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679077578"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><a href="#local-6989586621679077577"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679077574"><span class="hs-identifier hs-type">b</span></a></span></span></span></span></span></span></span><span>
</span><span id="line-398"></span><span id="liftCallCC%27"><span class="annot"><span class="annottext">liftCallCC' :: forall (m :: * -&gt; *) a s w b r.
CallCC m (a, s, w) (b, s, w) -&gt; CallCC (RWST r w s m) a b
</span><a href="Control.Monad.Trans.RWS.CPS.html#liftCallCC%27"><span class="hs-identifier hs-var hs-var">liftCallCC'</span></a></span></span><span> </span><span id="local-6989586621679077572"><span class="annot"><span class="annottext">CallCC m (a, s, w) (b, s, w)
</span><a href="#local-6989586621679077572"><span class="hs-identifier hs-var">callCC</span></a></span></span><span> </span><span id="local-6989586621679077571"><span class="annot"><span class="annottext">(a -&gt; RWST r w s m b) -&gt; RWST r w s m a
</span><a href="#local-6989586621679077571"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
forall r w s (m :: * -&gt; *) a.
(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-var">RWST</span></a></span><span> </span><span class="annot"><span class="annottext">((r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a)
-&gt; (r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679077570"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077570"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span id="local-6989586621679077569"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077569"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679077568"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077568"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-399"></span><span>    </span><span class="annot"><span class="annottext">CallCC m (a, s, w) (b, s, w)
</span><a href="#local-6989586621679077572"><span class="hs-identifier hs-var">callCC</span></a></span><span> </span><span class="annot"><span class="annottext">CallCC m (a, s, w) (b, s, w) -&gt; CallCC m (a, s, w) (b, s, w)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679077567"><span class="annot"><span class="annottext">(a, s, w) -&gt; m (b, s, w)
</span><a href="#local-6989586621679077567"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">RWST r w s m a -&gt; r -&gt; s -&gt; w -&gt; m (a, s, w)
forall r w s (m :: * -&gt; *) a.
RWST r w s m a -&gt; r -&gt; s -&gt; w -&gt; m (a, s, w)
</span><a href="Control.Monad.Trans.RWS.CPS.html#unRWST"><span class="hs-identifier hs-var hs-var">unRWST</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(a -&gt; RWST r w s m b) -&gt; RWST r w s m a
</span><a href="#local-6989586621679077571"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679077566"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679077566"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(r -&gt; s -&gt; w -&gt; m (b, s, w)) -&gt; RWST r w s m b
forall r w s (m :: * -&gt; *) a.
(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-var">RWST</span></a></span><span> </span><span class="annot"><span class="annottext">((r -&gt; s -&gt; w -&gt; m (b, s, w)) -&gt; RWST r w s m b)
-&gt; (r -&gt; s -&gt; w -&gt; m (b, s, w)) -&gt; RWST r w s m b
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span class="annot"><span class="annottext">r
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621679077565"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077565"><span class="hs-identifier hs-var">s'</span></a></span></span><span> </span><span class="annot"><span class="annottext">w
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(a, s, w) -&gt; m (b, s, w)
</span><a href="#local-6989586621679077567"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621679077566"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077565"><span class="hs-identifier hs-var">s'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077568"><span class="hs-identifier hs-var">w</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077570"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077569"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077568"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-400"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#liftCallCC%27"><span class="hs-pragma hs-type">liftCallCC'</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-401"></span><span>
</span><span id="line-402"></span><span class="hs-comment">-- | Lift a @catchE@ operation to the new monad.</span><span>
</span><span id="line-403"></span><span id="local-6989586621679078009"><span id="local-6989586621679078011"><span id="local-6989586621679078012"><span id="local-6989586621679078013"><span id="local-6989586621679078014"><span id="local-6989586621679078015"><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#liftCatch"><span class="hs-identifier hs-type">liftCatch</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Control.Monad.Signatures.html#Catch"><span class="hs-identifier hs-type">Catch</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078015"><span class="hs-identifier hs-type">e</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078014"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621679078013"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679078012"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">,</span><span class="annot"><a href="#local-6989586621679078011"><span class="hs-identifier hs-type">w</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Control.Monad.Signatures.html#Catch"><span class="hs-identifier hs-type">Catch</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078015"><span class="hs-identifier hs-type">e</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-type">RWST</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078009"><span class="hs-identifier hs-type">r</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078011"><span class="hs-identifier hs-type">w</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078012"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679078014"><span class="hs-identifier hs-type">m</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><a href="#local-6989586621679078013"><span class="hs-identifier hs-type">a</span></a></span></span></span></span></span></span></span><span>
</span><span id="line-404"></span><span id="liftCatch"><span class="annot"><span class="annottext">liftCatch :: forall e (m :: * -&gt; *) a s w r.
Catch e m (a, s, w) -&gt; Catch e (RWST r w s m) a
</span><a href="Control.Monad.Trans.RWS.CPS.html#liftCatch"><span class="hs-identifier hs-var hs-var">liftCatch</span></a></span></span><span> </span><span id="local-6989586621679077564"><span class="annot"><span class="annottext">Catch e m (a, s, w)
</span><a href="#local-6989586621679077564"><span class="hs-identifier hs-var">catchE</span></a></span></span><span> </span><span id="local-6989586621679077563"><span class="annot"><span class="annottext">RWST r w s m a
</span><a href="#local-6989586621679077563"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span id="local-6989586621679077562"><span class="annot"><span class="annottext">e -&gt; RWST r w s m a
</span><a href="#local-6989586621679077562"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-405"></span><span>    </span><span class="annot"><span class="annottext">(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
forall r w s (m :: * -&gt; *) a.
(r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
</span><a href="Control.Monad.Trans.RWS.CPS.html#RWST"><span class="hs-identifier hs-var">RWST</span></a></span><span> </span><span class="annot"><span class="annottext">((r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a)
-&gt; (r -&gt; s -&gt; w -&gt; m (a, s, w)) -&gt; RWST r w s m a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679077561"><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077561"><span class="hs-identifier hs-var">r</span></a></span></span><span> </span><span id="local-6989586621679077560"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077560"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621679077559"><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077559"><span class="hs-identifier hs-var">w</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">RWST r w s m a -&gt; r -&gt; s -&gt; w -&gt; m (a, s, w)
forall r w s (m :: * -&gt; *) a.
RWST r w s m a -&gt; r -&gt; s -&gt; w -&gt; m (a, s, w)
</span><a href="Control.Monad.Trans.RWS.CPS.html#unRWST"><span class="hs-identifier hs-var hs-var">unRWST</span></a></span><span> </span><span class="annot"><span class="annottext">RWST r w s m a
</span><a href="#local-6989586621679077563"><span class="hs-identifier hs-var">m</span></a></span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077561"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077560"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077559"><span class="hs-identifier hs-var">w</span></a></span><span> </span><span class="annot"><span class="annottext">Catch e m (a, s, w)
</span><a href="#local-6989586621679077564"><span class="hs-operator hs-var">`catchE`</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621679077558"><span class="annot"><span class="annottext">e
</span><a href="#local-6989586621679077558"><span class="hs-identifier hs-var">e</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">RWST r w s m a -&gt; r -&gt; s -&gt; w -&gt; m (a, s, w)
forall r w s (m :: * -&gt; *) a.
RWST r w s m a -&gt; r -&gt; s -&gt; w -&gt; m (a, s, w)
</span><a href="Control.Monad.Trans.RWS.CPS.html#unRWST"><span class="hs-identifier hs-var hs-var">unRWST</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">e -&gt; RWST r w s m a
</span><a href="#local-6989586621679077562"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="annot"><span class="annottext">e
</span><a href="#local-6989586621679077558"><span class="hs-identifier hs-var">e</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">r
</span><a href="#local-6989586621679077561"><span class="hs-identifier hs-var">r</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621679077560"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">w
</span><a href="#local-6989586621679077559"><span class="hs-identifier hs-var">w</span></a></span><span>
</span><span id="line-406"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Control.Monad.Trans.RWS.CPS.html#liftCatch"><span class="hs-pragma hs-type">liftCatch</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-407"></span></pre></body></html>